diff options
Diffstat (limited to 'archaeological_operations/tests.py')
-rw-r--r-- | archaeological_operations/tests.py | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py index 9d5b9c616..67f9454fa 100644 --- a/archaeological_operations/tests.py +++ b/archaeological_operations/tests.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright (C) 2012-2016 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet> +# Copyright (C) 2012-2017 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet> # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -699,7 +699,8 @@ class OperationTest(TestCase, OperationInitTest): '../archaeological_operations/fixtures/initial_data-fr.json'] def setUp(self): - IshtarSiteProfile.objects.create() + IshtarSiteProfile.objects.get_or_create( + slug='default', active=True) self.username, self.password, self.user = create_superuser() self.alt_username, self.alt_password, self.alt_user = create_user() self.alt_user.user_permissions.add(Permission.objects.get( @@ -886,7 +887,8 @@ class OperationSearchTest(TestCase, OperationInitTest): '../archaeological_operations/fixtures/initial_data-fr.json'] def setUp(self): - IshtarSiteProfile.objects.create() + IshtarSiteProfile.objects.get_or_create( + slug='default', active=True) self.username, self.password, self.user = create_superuser() self.alt_username, self.alt_password, self.alt_user = create_user() self.alt_user.user_permissions.add(Permission.objects.get( @@ -1012,7 +1014,7 @@ class RegisterTest(TestCase, OperationInitTest): def testSearch(self): c = Client() response = c.get(reverse('get-administrativeact'), {'year': '2014'}) - # no result when no authentification + # no result when no authentication self.assertTrue(not json.loads(response.content)) c.login(username=self.username, password=self.password) response = c.get(reverse('get-administrativeact'), {'year': '2014'}) @@ -1037,34 +1039,39 @@ class OperationWizardCreationTest(WizardTest, OperationInitTest, TestCase): FormData( "Create a preventive diag", form_datas={ + 'filechoice-operation_creation': {}, 'general-operation_creation': { 'operation_type': 1, # preventive diag 'year': 2016}, 'townsgeneral-operation_creation': [], 'parcelsgeneral-operation_creation': [], }, - ignored=('filechoice-operation_creation', - 'towns-operation_creation', + ignored=('towns-operation_creation', 'parcels-operation_creation', 'preventive-operation_creation',) ), FormData( "Create another preventive diag with same parcel name", form_datas={ + 'filechoice-operation_creation': {}, 'general-operation_creation': { 'operation_type': 1, # preventive diag 'year': 2016}, 'townsgeneral-operation_creation': [], 'parcelsgeneral-operation_creation': [], }, - ignored=('filechoice-operation_creation', - 'towns-operation_creation', + ignored=('towns-operation_creation', 'parcels-operation_creation', 'preventive-operation_creation',) ) ] def pre_wizard(self): + profile, created = IshtarSiteProfile.objects.get_or_create( + slug='default', active=True) + profile.files = True + profile.save() + if 'townsgeneral-operation_creation' not in \ self.form_datas[0].form_datas: return super(OperationWizardCreationTest, self).pre_wizard() |