def test_indexing_responses(self): """ Test add_to_search_index response with real data """ # Check results not indexed response = perform_search( "unique", user=self.user, size=10, from_=0, course_id=unicode(self.course.id)) self.assertEqual(response['results'], []) # Start manual reindex errors = CoursewareSearchIndexer.do_course_reindex(modulestore(), self.course.id) self.assertEqual(errors, None) self.html.display_name = "My expanded HTML" modulestore().update_item(self.html, ModuleStoreEnum.UserID.test) # Start manual reindex errors = CoursewareSearchIndexer.do_course_reindex(modulestore(), self.course.id) self.assertEqual(errors, None) # Check results indexed now response = perform_search( "unique", user=self.user, size=10, from_=0, course_id=unicode(self.course.id)) self.assertEqual(response['total'], 1)
def test_reindex_json_responses(self): """ Test json response with real data """ # Check results not indexed response = perform_search( "unique", user=self.user, size=10, from_=0, course_id=unicode(self.course.id)) self.assertEqual(response['results'], []) # Start manual reindex reindex_course_and_check_access(self.course.id, self.user) self.html.display_name = "My expanded HTML" modulestore().update_item(self.html, ModuleStoreEnum.UserID.test) # Start manual reindex reindex_course_and_check_access(self.course.id, self.user) # Check results indexed now response = perform_search( "unique", user=self.user, size=10, from_=0, course_id=unicode(self.course.id)) self.assertEqual(response['total'], 1)
def test_indexing_responses(self): """ Test add_to_search_index response with real data """ # Check results not indexed response = perform_search("unique", user=self.user, size=10, from_=0, course_id=unicode(self.course.id)) self.assertEqual(response['results'], []) # Start manual reindex errors = CoursewareSearchIndexer.do_course_reindex( modulestore(), self.course.id) self.assertEqual(errors, None) self.html.display_name = "My expanded HTML" modulestore().update_item(self.html, ModuleStoreEnum.UserID.test) # Start manual reindex errors = CoursewareSearchIndexer.do_course_reindex( modulestore(), self.course.id) self.assertEqual(errors, None) # Check results indexed now response = perform_search("unique", user=self.user, size=10, from_=0, course_id=unicode(self.course.id)) self.assertEqual(response['total'], 1)
def test_reindex_json_responses(self): """ Test json response with real data """ # Check results not indexed response = perform_search("unique", user=self.user, size=10, from_=0, course_id=unicode(self.course.id)) self.assertEqual(response['results'], []) # Start manual reindex reindex_course_and_check_access(self.course.id, self.user) self.html.display_name = "My expanded HTML" modulestore().update_item(self.html, ModuleStoreEnum.UserID.test) # Start manual reindex reindex_course_and_check_access(self.course.id, self.user) # Check results indexed now response = perform_search("unique", user=self.user, size=10, from_=0, course_id=unicode(self.course.id)) self.assertEqual(response['total'], 1)
def test_indexing_responses(self): """ Test do_course_reindex response with real data """ # results are indexed because they are published from ItemFactory response = perform_search( "unique", user=self.user, size=10, from_=0, course_id=unicode(self.course.id)) self.assertEqual(response['total'], 1) # Start manual reindex CoursewareSearchIndexer.do_course_reindex(modulestore(), self.course.id) # Check results are the same following reindex response = perform_search( "unique", user=self.user, size=10, from_=0, course_id=unicode(self.course.id)) self.assertEqual(response['total'], 1)
def test_reindex_json_responses(self): """ Test json response with real data """ # results are indexed because they are published from ItemFactory response = perform_search("unique", user=self.user, size=10, from_=0, course_id=unicode(self.course.id)) self.assertEqual(response["total"], 1) # Start manual reindex reindex_course_and_check_access(self.course.id, self.user) # Check results remain the same response = perform_search("unique", user=self.user, size=10, from_=0, course_id=unicode(self.course.id)) self.assertEqual(response["total"], 1)
def test_reindex_json_responses(self): """ Test json response with real data """ # results are indexed because they are published from ItemFactory response = perform_search("unique", user=self.user, size=10, from_=0, course_id=unicode(self.course.id)) self.assertEqual(response['total'], 1) # Start manual reindex reindex_course_and_check_access(self.course.id, self.user) # Check results remain the same response = perform_search("unique", user=self.user, size=10, from_=0, course_id=unicode(self.course.id)) self.assertEqual(response['total'], 1)
def test_indexing_responses(self): """ Test do_course_reindex response with real data """ # results are indexed because they are published from ItemFactory response = perform_search("unique", user=self.user, size=10, from_=0, course_id=unicode(self.course.id)) self.assertEqual(response['total'], 1) # Start manual reindex CoursewareSearchIndexer.do_course_reindex(modulestore(), self.course.id) # Check results are the same following reindex response = perform_search("unique", user=self.user, size=10, from_=0, course_id=unicode(self.course.id)) self.assertEqual(response['total'], 1)
def test_reindex_html_error_json_responses(self, mock_index_dictionary): """ Test json response with mocked error data for html """ # results are indexed because they are published from ItemFactory response = perform_search("unique", user=self.user, size=10, from_=0, course_id=unicode(self.course.id)) self.assertEqual(response["total"], 1) # set mocked exception response err = SearchIndexingError mock_index_dictionary.return_value = err # Start manual reindex and check error in response with self.assertRaises(SearchIndexingError): reindex_course_and_check_access(self.course.id, self.user)
def test_indexing_seq_error_responses(self, mock_index_dictionary): """ Test do_course_reindex response with mocked error data for sequence """ # results are indexed because they are published from ItemFactory response = perform_search("unique", user=self.user, size=10, from_=0, course_id=unicode(self.course.id)) self.assertEqual(response["total"], 1) # set mocked exception response err = Exception mock_index_dictionary.return_value = err # Start manual reindex and check error in response with self.assertRaises(SearchIndexingError): CoursewareSearchIndexer.do_course_reindex(modulestore(), self.course.id)
def test_reindex_seq_error_json_responses(self, mock_index_dictionary): """ Test json response with mocked error data for sequence """ # results are indexed because they are published from ItemFactory response = perform_search("unique", user=self.user, size=10, from_=0, course_id=unicode(self.course.id)) self.assertEqual(response['total'], 1) # set mocked exception response err = Exception mock_index_dictionary.return_value = err # Start manual reindex and check error in response with self.assertRaises(SearchIndexingError): reindex_course_and_check_access(self.course.id, self.user)
def test_reindex_html_error_json_responses(self, mock_index_dictionary): """ Test json response with mocked error data for html """ # Check results not indexed response = perform_search("unique", user=self.user, size=10, from_=0, course_id=unicode(self.course.id)) self.assertEqual(response['results'], []) # set mocked exception response err = SearchIndexingError mock_index_dictionary.return_value = err # Start manual reindex and check error in response with self.assertRaises(SearchIndexingError): reindex_course_and_check_access(self.course.id, self.user)
def test_indexing_html_error_responses(self, mock_index_dictionary): """ Test do_course_reindex response with mocked error data for html """ # results are indexed because they are published from ItemFactory response = perform_search("unique", user=self.user, size=10, from_=0, course_id=unicode(self.course.id)) self.assertEqual(response['total'], 1) # set mocked exception response err = Exception mock_index_dictionary.return_value = err # Start manual reindex and check error in response with self.assertRaises(SearchIndexingError): CoursewareSearchIndexer.do_course_reindex(modulestore(), self.course.id)
def test_indexing_seq_error_responses(self, mock_index_dictionary): """ Test add_to_search_index response with mocked error data for sequence """ # Check results not indexed response = perform_search("unique", user=self.user, size=10, from_=0, course_id=unicode(self.course.id)) self.assertEqual(response['results'], []) # set mocked exception response err = Exception mock_index_dictionary.return_value = err # Start manual reindex and check error in response with self.assertRaises(SearchIndexingError): CoursewareSearchIndexer.do_course_reindex(modulestore(), self.course.id)
def test_indexing_seq_error_responses(self, mock_index_dictionary): """ Test add_to_search_index response with mocked error data for sequence """ # Check results not indexed response = perform_search( "unique", user=self.user, size=10, from_=0, course_id=unicode(self.course.id)) self.assertEqual(response['results'], []) # set mocked exception response err = Exception mock_index_dictionary.return_value = err # Start manual reindex and check error in response with self.assertRaises(SearchIndexingError): CoursewareSearchIndexer.do_course_reindex(modulestore(), self.course.id)
def test_reindex_seq_error_json_responses(self, mock_index_dictionary): """ Test json response with rmocked error data for sequence """ # Check results not indexed response = perform_search( "unique", user=self.user, size=10, from_=0, course_id=unicode(self.course.id)) self.assertEqual(response['results'], []) # set mocked exception response err = Exception mock_index_dictionary.return_value = err # Start manual reindex and check error in response with self.assertRaises(SearchIndexingError): reindex_course_and_check_access(self.course.id, self.user)
def test_perform_search(self): """ search opertaion should yeild an exception with no search engine """ with self.assertRaises(NoSearchEngineError): perform_search("abc test")