summaryrefslogtreecommitdiff
path: root/archaeological_operations/tests.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2019-03-09 15:58:12 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2019-06-17 13:21:27 +0200
commitb1f4a23679de9a561ed8ec3be9b79e851873bc0f (patch)
tree0a765dbfd1877003c31199df7a8d3c634c879427 /archaeological_operations/tests.py
parent3af2e203536c5f17f4a3f627c3b6990348118aa0 (diff)
downloadIshtar-b1f4a23679de9a561ed8ec3be9b79e851873bc0f.tar.bz2
Ishtar-b1f4a23679de9a561ed8ec3be9b79e851873bc0f.zip
Fix document deletion - tests
Diffstat (limited to 'archaeological_operations/tests.py')
-rw-r--r--archaeological_operations/tests.py31
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)