diff options
-rw-r--r-- | archaeological_finds/tests.py | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/archaeological_finds/tests.py b/archaeological_finds/tests.py index 7ae81a1bb..5ea5adfb7 100644 --- a/archaeological_finds/tests.py +++ b/archaeological_finds/tests.py @@ -37,7 +37,7 @@ from ishtar_common import forms_common from ishtar_common.tests import WizardTest, WizardTestFormData as FormData, \ TestCase -from archaeological_operations.tests import ImportTest +from archaeological_operations.tests import ImportTest, create_operation from archaeological_context_records.tests import ContextRecordInit, \ CONTEXT_RECORD_FIXTURES, CONTEXT_RECORD_TOWNS_FIXTURES @@ -526,6 +526,28 @@ class FindSearchTest(FindInit, TestCase): self.assertEqual(response.status_code, 200) self.assertTrue(json.loads(response.content)['total'] == 1) + def test_pinned_search(self): + c = Client() + c.login(username=self.username, password=self.password) + + # operation with no associated find + operation = create_operation(self.user, values={"year": 2017}) + c.get(reverse("pin", args=["operation", operation.pk])) + response = c.get(reverse('get-find'), {}) # empty search -> check pined + self.assertEqual(response.status_code, 200) + self.assertEqual(json.loads(response.content)['total'], 0) + + # pinned operation with current find + find = self.finds[0] + c.get(reverse( + "pin", + args=["operation", + find.get_first_base_find().context_record.operation.pk])) + response = c.get(reverse('get-find'), {}) # empty search -> check pined + self.assertEqual(response.status_code, 200) + self.assertEqual(json.loads(response.content)['total'], 1) + + def testPeriodHierarchicSearch(self): find = self.finds[0] c = Client() |