Commit 4cc2dffd by Tim Babych

do not call update_index in tests

parent c87dde93
...@@ -31,7 +31,6 @@ class BaseAnnotationViewTests(APITestCase): ...@@ -31,7 +31,6 @@ class BaseAnnotationViewTests(APITestCase):
""" """
def setUp(self): def setUp(self):
call_command('clear_index', interactive=False) call_command('clear_index', interactive=False)
call_command('update_index')
token = get_id_token(TEST_USER) token = get_id_token(TEST_USER)
self.client.credentials(HTTP_X_ANNOTATOR_AUTH_TOKEN=token) self.client.credentials(HTTP_X_ANNOTATOR_AUTH_TOKEN=token)
...@@ -62,14 +61,12 @@ class BaseAnnotationViewTests(APITestCase): ...@@ -62,14 +61,12 @@ class BaseAnnotationViewTests(APITestCase):
url = reverse('api:v1:annotations') url = reverse('api:v1:annotations')
response = self.client.post(url, opts, format='json') response = self.client.post(url, opts, format='json')
self.assertEqual(response.status_code, status.HTTP_201_CREATED) self.assertEqual(response.status_code, status.HTTP_201_CREATED)
call_command('update_index')
return response.data.copy() return response.data.copy()
def _get_annotation(self, annotation_id): def _get_annotation(self, annotation_id):
""" """
Fetch annotation Fetch annotation
""" """
call_command('update_index')
url = reverse('api:v1:annotations_detail', kwargs={'annotation_id': annotation_id}) url = reverse('api:v1:annotations_detail', kwargs={'annotation_id': annotation_id})
response = self.client.get(url, self.headers) response = self.client.get(url, self.headers)
self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertEqual(response.status_code, status.HTTP_200_OK)
...@@ -268,7 +265,6 @@ class AnnotationDetailViewTests(BaseAnnotationViewTests): ...@@ -268,7 +265,6 @@ class AnnotationDetailViewTests(BaseAnnotationViewTests):
payload.update(self.headers) payload.update(self.headers)
url = reverse('api:v1:annotations_detail', kwargs={'annotation_id': data['id']}) url = reverse('api:v1:annotations_detail', kwargs={'annotation_id': data['id']})
response = self.client.put(url, payload, format='json') response = self.client.put(url, payload, format='json')
call_command('update_index')
self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertEqual(response.status_code, status.HTTP_200_OK)
annotation = self._get_annotation(data['id']) annotation = self._get_annotation(data['id'])
...@@ -341,8 +337,6 @@ class AnnotationDetailViewTests(BaseAnnotationViewTests): ...@@ -341,8 +337,6 @@ class AnnotationDetailViewTests(BaseAnnotationViewTests):
response = self.client.delete(url, self.headers) response = self.client.delete(url, self.headers)
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT, "response should be 204 NO CONTENT") self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT, "response should be 204 NO CONTENT")
call_command('update_index')
url = reverse('api:v1:annotations_detail', kwargs={'annotation_id': note['id']}) url = reverse('api:v1:annotations_detail', kwargs={'annotation_id': note['id']})
response = self.client.get(url, self.headers) response = self.client.get(url, self.headers)
self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND) self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
...@@ -429,7 +423,6 @@ class AnnotationSearchlViewTests(BaseAnnotationViewTests): ...@@ -429,7 +423,6 @@ class AnnotationSearchlViewTests(BaseAnnotationViewTests):
payload.update(self.headers) payload.update(self.headers)
url = reverse('api:v1:annotations_detail', kwargs={'annotation_id': note['id']}) url = reverse('api:v1:annotations_detail', kwargs={'annotation_id': note['id']})
response = self.client.put(url, payload, format='json') response = self.client.put(url, payload, format='json')
call_command('update_index')
results = self._get_search_results() results = self._get_search_results()
self.assertEqual(results['rows'][0]['text'], 'Updated Second Note') self.assertEqual(results['rows'][0]['text'], 'Updated Second Note')
......
...@@ -12,7 +12,7 @@ TIME_ZONE = 'UTC' ...@@ -12,7 +12,7 @@ TIME_ZONE = 'UTC'
# This value needs to be overriden in production. # This value needs to be overriden in production.
SECRET_KEY = '*^owi*4%!%9=#h@app!l^$jz8(c*q297^)4&4yn^#_m#fq=z#l' SECRET_KEY = '*^owi*4%!%9=#h@app!l^$jz8(c*q297^)4&4yn^#_m#fq=z#l'
ALLOWED_HOSTS = ['localhost','*.edx.org'] ALLOWED_HOSTS = ['localhost', '*.edx.org']
# ID and Secret used for authenticating JWT Auth Tokens # ID and Secret used for authenticating JWT Auth Tokens
# should match those configured for `edx-notes` Client in EdX's /admin/oauth2/client/ # should match those configured for `edx-notes` Client in EdX's /admin/oauth2/client/
......
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