diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-01-27 19:24:00 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-01-27 19:24:00 +0100 |
commit | 29fe73d51ae8e50caffe5bb6e0cf2ba939d9a70d (patch) | |
tree | 8bf97c52e86a824093db25131ea12243e96ecd3b /archaeological_operations/tests.py | |
parent | 995fa47d8cb0a9e2922cde89b7eaaf61968fe343 (diff) | |
download | Ishtar-29fe73d51ae8e50caffe5bb6e0cf2ba939d9a70d.tar.bz2 Ishtar-29fe73d51ae8e50caffe5bb6e0cf2ba939d9a70d.zip |
Manage relation types in searches - relation type search for operations
Diffstat (limited to 'archaeological_operations/tests.py')
-rw-r--r-- | archaeological_operations/tests.py | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py index 91ec1deb0..578382ccd 100644 --- a/archaeological_operations/tests.py +++ b/archaeological_operations/tests.py @@ -514,9 +514,9 @@ class OperationInitTest(object): class OperationTest(TestCase, OperationInitTest): fixtures = [settings.ROOT_PATH + - '../fixtures/initial_data.json', + '../fixtures/initial_data-auth-fr.json', settings.ROOT_PATH + - '../ishtar_common/fixtures/initial_data.json', + '../ishtar_common/fixtures/initial_data-fr.json', settings.ROOT_PATH + '../archaeological_files/fixtures/initial_data.json', settings.ROOT_PATH + @@ -544,6 +544,27 @@ class OperationTest(TestCase, OperationInitTest): {'operator': self.orgas[0].pk}) self.assertTrue(json.loads(response.content)['total'] == 2) + def testRelatedSearch(self): + c = Client() + rel1 = models.RelationType.objects.create( + symmetrical=True, label='Include', txt_idx='include') + rel2 = models.RelationType.objects.create( + symmetrical=False, label='Included', txt_idx='included', + inverse_relation=rel1) + models.RecordRelations.objects.create( + left_record=self.operations[0], + right_record=self.operations[1], + relation_type=rel1) + self.operations[1].year = 2011 + self.operations[1].save() + search = {'year': '2010', 'relation_types_0': rel2.pk} + response = c.get(reverse('get-operation'), search) + # no result when no authentification + self.assertTrue(not json.loads(response.content)) + c.login(username=self.username, password=self.password) + response = c.get(reverse('get-operation'), search) + self.assertTrue(json.loads(response.content)['total'] == 2) + def testOwnSearch(self): c = Client() response = c.get(reverse('get-operation'), {'year': '2010'}) |