diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-03-23 13:33:55 +0100 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-03-23 13:33:55 +0100 | 
| commit | 12f42cd4150b18e150e9bc490c2559e78e89587b (patch) | |
| tree | 6de42075e7c5a9803c9f8a178457b0d9f0263b77 | |
| parent | 492a1b9c0acee48cb6d9334d93ab55512a5981a6 (diff) | |
| download | Ishtar-12f42cd4150b18e150e9bc490c2559e78e89587b.tar.bz2 Ishtar-12f42cd4150b18e150e9bc490c2559e78e89587b.zip  | |
Operation wizards: adapt test to match new filtering of forms (ref #3367)
| -rw-r--r-- | archaeological_operations/tests.py | 21 | 
1 files changed, 14 insertions, 7 deletions
diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py index 9d5b9c616..e1ae68237 100644 --- a/archaeological_operations/tests.py +++ b/archaeological_operations/tests.py @@ -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()  | 
