diff options
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'}) | 
