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