diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-07-16 13:03:27 +0200 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-07-16 13:03:27 +0200 | 
| commit | 6bb7d4cbf47c61fd168998a0423a31814eaa7fe0 (patch) | |
| tree | f0b7c63834d4fe9125d043893dad8765975a78b1 /archaeological_operations/tests.py | |
| parent | 3748baac6501db293424d1ae5d092e8672a68f7f (diff) | |
| parent | 242c13fdc9895abdcd1af79bce2a9b3f98f3f939 (diff) | |
| download | Ishtar-6bb7d4cbf47c61fd168998a0423a31814eaa7fe0.tar.bz2 Ishtar-6bb7d4cbf47c61fd168998a0423a31814eaa7fe0.zip | |
Merge branch 'master-WIP-treatments'
Diffstat (limited to 'archaeological_operations/tests.py')
| -rw-r--r-- | archaeological_operations/tests.py | 60 | 
1 files changed, 41 insertions, 19 deletions
| diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py index c22cf4b37..29a7fdb00 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-2015 Étienne Loks  <etienne.loks_AT_peacefrogsDOTnet> +# Copyright (C) 2012-2016 É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 @@ -29,13 +29,16 @@ from django.core.urlresolvers import reverse  from django.test import TestCase  from django.test.client import Client -from django.contrib.auth.models import User, Permission +from django.contrib.auth.models import Permission  import models +from archaeological_operations import views +  from ishtar_common.models import OrganizationType, Organization, \      ImporterType, IshtarUser, TargetKey  from ishtar_common import forms_common +from ishtar_common.tests import WizardTest, create_superuser, create_user  class ImportOperationTest(TestCase): @@ -416,23 +419,6 @@ class ImportOperationTest(TestCase):                  "recognized in \"%s\"" % (str(not_imported), value)) -def create_superuser(): -    username = 'username4277' -    password = 'dcbqj756456!@%' -    user = User.objects.create_superuser(username, "nomail@nomail.com", -                                         password) -    return username, password, user - - -def create_user(): -    username = 'username678' -    password = 'dcbqj756456!@%' -    user = User.objects.create_user(username, email="nomail2@nomail.com") -    user.set_password(password) -    user.save() -    return username, password, user - -  def create_orga(user):      orga_type, created = OrganizationType.objects.get_or_create(          txt_idx='operator') @@ -626,3 +612,39 @@ class RegisterTest(TestCase, OperationInitTest):          self.assertTrue(json.loads(response.content)['total'] == 1)          response = c.get(reverse('get-administrativeact'), {'indexed': '2'})          self.assertTrue(json.loads(response.content)['total'] == 1) + + +class OperationWizardCreationTest(WizardTest, OperationInitTest, TestCase): +    fixtures = [settings.ROOT_PATH + +                '../fixtures/initial_data-auth-fr.json', +                settings.ROOT_PATH + +                '../ishtar_common/fixtures/initial_data-fr.json', +                settings.ROOT_PATH + +                '../archaeological_files/fixtures/initial_data.json', +                settings.ROOT_PATH + +                '../archaeological_operations/fixtures/initial_data-fr.json'] +    url_name = 'operation_creation' +    wizard_name = 'operation_wizard' +    steps = views.wizard_steps +    form_datas = [( +        # data +        { +            'general-operation_creation': { +                'operation_type': 1,  # preventive diag +                'year': 2016} +        }, +        # ignored +        ('filechoice-operation_creation', +         'preventive-operation_creation', +         'towns-operation_creation', +         'parcels-operation_creation', +         ) +    )] + +    def pre_wizard(self): +        self.operation_number = models.Operation.objects.count() +        super(OperationWizardCreationTest, self).pre_wizard() + +    def post_wizard(self): +        self.assertEqual(models.Operation.objects.count(), +                         self.operation_number + 1) | 
