diff options
Diffstat (limited to 'archaeological_operations/tests.py')
| -rw-r--r-- | archaeological_operations/tests.py | 31 | 
1 files changed, 31 insertions, 0 deletions
diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py index 3f35de73b..e1f29b293 100644 --- a/archaeological_operations/tests.py +++ b/archaeological_operations/tests.py @@ -37,6 +37,7 @@ from django.contrib.auth.models import User, Permission  from django.utils.translation import ugettext_lazy as _, pgettext, pgettext_lazy  from . import models +from ishtar_common.views import document_deletion_steps  from archaeological_operations import views  from ishtar_common.models import OrganizationType, Organization, ItemKey, \ @@ -2805,3 +2806,33 @@ class DocumentTest(OperationInitTest, TestCase):          self.assertIn(posted["title"], response.content.decode()) +class DocumentWizardDeleteTest(WizardTest, OperationInitTest, TestCase): +    fixtures = FILE_FIXTURES +    url_name = 'document_deletion' +    url_uri = "document/delete" +    wizard_name = 'document_deletion_wizard' +    steps = document_deletion_steps +    form_datas = [ +        FormData( +            "Delete document", +            form_datas={ +                'selec': {'pk': None}, +            }, +        ), +    ] + +    def pre_wizard(self): +        ope = self.get_default_operation() +        document = Document.objects.create(title="testy") +        document.operations.add(ope) +        self.ope_id = ope.pk +        self.form_datas[0].set('selec', 'pk', document.pk) +        self.doc_nb = Document.objects.count() +        super(DocumentWizardDeleteTest, self).pre_wizard() + +    def post_wizard(self): +        self.assertEqual(Document.objects.count(), +                         self.doc_nb - 1) +        # operation not deleted with the document +        self.assertEqual(models.Operation.objects.filter( +            pk=self.ope_id).count(), 1)  | 
