Commit a43cf589 by Davorin Sego

Update edx-search, fix lms filter generator and courseware index tests

parent 845e1d62
......@@ -871,8 +871,7 @@ class TestLibrarySearchIndexer(MixedWithOptionsTestCase):
self.update_item(store, self.html_unit1)
self.reindex_library(store)
response = self.search()
# TODO: MockSearchEngine never updates existing item: returns 3 items here - uncomment when it's fixed
# self.assertEqual(response["total"], 2)
self.assertEqual(response["total"], 2)
html_contents = [cont['html_content'] for cont in self._get_contents(response)]
self.assertIn(new_data, html_contents)
......@@ -1264,7 +1263,7 @@ class GroupConfigurationSearchMongo(CourseTestCase, MixedWithOptionsTestCase):
added_to_index = self.reindex_course(self.store)
self.assertEqual(added_to_index, 16)
response = self.searcher.search(field_dictionary={"course": unicode(self.course.id)})
self.assertEqual(response["total"], 23)
self.assertEqual(response["total"], 17)
group_access_content = {'group_access': {666: [1]}}
......
......@@ -4,6 +4,7 @@ Test courseware search
import os
import json
from ..helpers import remove_file
from ...pages.common.logout import LogoutPage
from ...pages.studio.overview import CourseOutlinePage
from ...pages.lms.courseware_search import CoursewareSearchPage
......@@ -40,6 +41,7 @@ class CoursewareSearchCohortTest(ContainerBase):
# create test file in which index for this test will live
with open(self.TEST_INDEX_FILENAME, "w+") as index_file:
json.dump({}, index_file)
self.addCleanup(remove_file, self.TEST_INDEX_FILENAME)
super(CoursewareSearchCohortTest, self).setUp(is_staff=is_staff)
self.staff_user = self.user
......@@ -79,10 +81,6 @@ class CoursewareSearchCohortTest(ContainerBase):
self._studio_reindex()
def tearDown(self):
super(CoursewareSearchCohortTest, self).tearDown()
os.remove(self.TEST_INDEX_FILENAME)
def _auto_auth(self, username, email, staff):
"""
Logout and login with given credentials.
......
......@@ -4,6 +4,7 @@ Test courseware search
import os
import json
from ..helpers import remove_file
from ...pages.common.logout import LogoutPage
from ...pages.studio.overview import CourseOutlinePage
from ...pages.lms.courseware_search import CoursewareSearchPage
......@@ -37,6 +38,7 @@ class SplitTestCoursewareSearchTest(ContainerBase):
# create test file in which index for this test will live
with open(self.TEST_INDEX_FILENAME, "w+") as index_file:
json.dump({}, index_file)
self.addCleanup(remove_file, self.TEST_INDEX_FILENAME)
super(SplitTestCoursewareSearchTest, self).setUp(is_staff=is_staff)
self.staff_user = self.user
......@@ -53,10 +55,6 @@ class SplitTestCoursewareSearchTest(ContainerBase):
self._add_and_configure_split_test()
self._studio_reindex()
def tearDown(self):
super(SplitTestCoursewareSearchTest, self).tearDown()
os.remove(self.TEST_INDEX_FILENAME)
def _auto_auth(self, username, email, staff):
"""
Logout and login with given credentials.
......
......@@ -72,7 +72,7 @@ class LmsSearchFilterGenerator(SearchFilterGenerator):
course_key = SlashSeparatedCourseKey.from_deprecated_string(kwargs['course_id'])
# Staff user looking at course as staff user
if get_user_role(user, course_key) == 'staff':
if get_user_role(user, course_key) in ('instructor', 'staff'):
return filter_dictionary
# Need to check course exist (if course gets deleted enrollments don't get cleaned up)
course = modulestore().get_course(course_key)
......
......@@ -77,7 +77,8 @@ class LmsSearchInitializerTestCase(StaffMasqueradeTestCase):
user=self.global_staff,
course_id=unicode(self.course.id)
)
self.assertIsNone(filter_directory['content_groups'])
# User is staff by default, no content groups filter is set - see all
self.assertNotIn('content_groups', filter_directory)
# Install a masquerading group
request = self._create_mock_json_request(
......
......@@ -47,7 +47,7 @@ git+https://github.com/edx/ease.git@release-2015-07-14#egg=ease==0.1.3
git+https://github.com/edx/edx-oauth2-provider.git@0.5.5#egg=oauth2-provider==0.5.5
-e git+https://github.com/edx/edx-val.git@v0.0.5#egg=edx-val
-e git+https://github.com/pmitros/RecommenderXBlock.git@518234bc354edbfc2651b9e534ddb54f96080779#egg=recommender-xblock
-e git+https://github.com/edx/edx-search.git@release-2015-07-14#egg=edx-search
-e git+https://github.com/edx/edx-search.git@release-2015-07-22#egg=edx-search
-e git+https://github.com/edx/edx-milestones.git@release-2015-06-17#egg=edx-milestones
git+https://github.com/edx/edx-lint.git@ed8c8d2a0267d4d42f43642d193e25f8bd575d9b#egg=edx_lint==0.2.3
-e git+https://github.com/edx/xblock-utils.git@213a97a50276d6a2504d8133650b2930ead357a0#egg=xblock-utils
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment