diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-07-12 00:03:40 +0200 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-07-12 00:03:40 +0200 | 
| commit | f2e2d4f7c7172cc84c14613ea4049ae54e75d818 (patch) | |
| tree | be1a35bf25a0799189bb6440afade00930c67070 | |
| parent | 25bc49ad788b6ffe640d7306c20a6341cd1d6a90 (diff) | |
| download | Ishtar-f2e2d4f7c7172cc84c14613ea4049ae54e75d818.tar.bz2 Ishtar-f2e2d4f7c7172cc84c14613ea4049ae54e75d818.zip  | |
Find deletion tests
| -rw-r--r-- | archaeological_finds/tests.py | 34 | ||||
| -rw-r--r-- | archaeological_finds/views.py | 7 | 
2 files changed, 37 insertions, 4 deletions
diff --git a/archaeological_finds/tests.py b/archaeological_finds/tests.py index b6382b720..41e113245 100644 --- a/archaeological_finds/tests.py +++ b/archaeological_finds/tests.py @@ -26,7 +26,7 @@ from django.core.files.uploadedfile import SimpleUploadedFile  from django.core.urlresolvers import reverse  from django.test.client import Client  from ishtar_common.models import ImporterType, IshtarUser, ImporterColumn,\ -    FormaterType, ImportTarget +    FormaterType, ImportTarget, IshtarSiteProfile  from ishtar_common.models import Person, get_current_profile  from archaeological_context_records.models import Period, Dating @@ -92,7 +92,6 @@ class FindInit(ContextRecordInit):  class FindWizardCreationTest(WizardTest, FindInit, TestCase): -    # TODO: first to be run because of strange init things...      fixtures = [settings.ROOT_PATH +                  '../fixtures/initial_data.json',                  settings.ROOT_PATH + @@ -149,6 +148,37 @@ class FindWizardCreationTest(WizardTest, FindInit, TestCase):                           self.find_number + 1) +class FindWizardDeletionWithWarehouseModTest(WizardTest, FindInit, TestCase): +    fixtures = FindWizardCreationTest.fixtures +    url_name = 'find_deletion' +    wizard_name = 'find_deletion_wizard' +    steps = views.find_deletion_steps +    form_datas = [ +        FormData( +            'Find deletion', +            form_datas={ +                'selecw': {}, +            }, +            ignored=['selec-find_deletion'] +        ) +    ] + +    def pre_wizard(self): +        profile, created = IshtarSiteProfile.objects.get_or_create( +            slug='default', active=True) +        profile.warehouse = True +        profile.save() + +        find, bf = self.get_default_find(force=True) +        self.form_datas[0].set('selecw', 'pk', find.pk) +        self.find_number = models.Find.objects.count() +        super(FindWizardDeletionWithWarehouseModTest, self).pre_wizard() + +    def post_wizard(self): +        self.assertEqual(models.Find.objects.count(), +                         self.find_number - 1) + +  class TreatmentWizardCreationTest(WizardTest, FindInit, TestCase):      fixtures = [settings.ROOT_PATH +                  '../fixtures/initial_data.json', diff --git a/archaeological_finds/views.py b/archaeological_finds/views.py index 680faf421..2e84757c9 100644 --- a/archaeological_finds/views.py +++ b/archaeological_finds/views.py @@ -181,10 +181,13 @@ find_deletion_condition_dict = {      'selecw-find_deletion': check_warehouse_module,  } -find_deletion_wizard = FindDeletionWizard.as_view([ +find_deletion_steps = [      ('selec-find_deletion', FindFormSelection),      ('selecw-find_deletion', FindFormSelectionWarehouseModule), -    ('final-find_deletion', FindDeletionForm)], +    ('final-find_deletion', FindDeletionForm)] + +find_deletion_wizard = FindDeletionWizard.as_view( +    find_deletion_steps,      condition_dict=find_deletion_condition_dict,      label=_(u"Find deletion"),      url_name='find_deletion',)  | 
