Update dynamic_search app to work with organizations. Remove Recent search feature.

This commit is contained in:
Roberto Rosario
2016-06-30 18:46:26 -04:00
parent 1b8436add7
commit aa56e8ae14
18 changed files with 37 additions and 269 deletions
+5 -23
View File
@@ -1,38 +1,21 @@
from __future__ import unicode_literals
from json import loads
from django.contrib.auth import get_user_model
from django.core.urlresolvers import reverse
from django.test import override_settings
from rest_framework.test import APITestCase
from documents.models import DocumentType
from documents.tests import TEST_DOCUMENT_TYPE, TEST_SMALL_DOCUMENT_PATH
from user_management.tests import (
TEST_ADMIN_EMAIL, TEST_ADMIN_PASSWORD, TEST_ADMIN_USERNAME
)
from rest_api.tests import GenericAPITestCase
@override_settings(OCR_AUTO_OCR=False)
class SearchAPITestCase(APITestCase):
class SearchAPITestCase(GenericAPITestCase):
"""
Test the search API endpoints
"""
def setUp(self):
self.admin_user = get_user_model().objects.create_superuser(
username=TEST_ADMIN_USERNAME, email=TEST_ADMIN_EMAIL,
password=TEST_ADMIN_PASSWORD
)
self.client.login(
username=TEST_ADMIN_USERNAME, password=TEST_ADMIN_PASSWORD
)
def test_search(self):
document_type = DocumentType.objects.create(
document_type = DocumentType.on_organization.create(
label=TEST_DOCUMENT_TYPE
)
@@ -45,6 +28,5 @@ class SearchAPITestCase(APITestCase):
'{}?q={}'.format(reverse('rest_api:search-view'), document.label)
)
content = loads(response.content)
self.assertEqual(content['results'][0]['label'], document.label)
self.assertEqual(content['count'], 1)
self.assertEqual(response.data['results'][0]['label'], document.label)
self.assertEqual(response.data['count'], 1)