summaryrefslogtreecommitdiff
path: root/ishtar_common/tests.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2025-05-02 11:07:32 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2025-05-02 11:07:32 +0200
commite3b68d0240cc3af1d68f4807ac8eceb8e9c908cd (patch)
treece4f68ce1455d108b2336ea502bba51483388d0d /ishtar_common/tests.py
parent369f7d3c12afbdbe3f61f8fecee59d2478bb73ab (diff)
downloadIshtar-e3b68d0240cc3af1d68f4807ac8eceb8e9c908cd.tar.bz2
Ishtar-e3b68d0240cc3af1d68f4807ac8eceb8e9c908cd.zip
🚑️ person wizard: fix person creation
Diffstat (limited to 'ishtar_common/tests.py')
-rw-r--r--ishtar_common/tests.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py
index 5692c9863..8fd5ac9e1 100644
--- a/ishtar_common/tests.py
+++ b/ishtar_common/tests.py
@@ -4307,6 +4307,41 @@ class NewItems(TestCase):
self.assertEqual(person.author.count(), 1)
+class PersonWizardTest(WizardTest, TestCase):
+ fixtures = [
+ FIXTURE_AUTH_PATH + "fixtures/initial_data-auth-fr.json",
+ LIB_BASE_PATH + "ishtar_common/fixtures/initial_data-fr.json",
+ ]
+ url_name = "person_creation"
+ wizard_name = "person_wizard"
+ steps = views.person_creation_wizard_steps
+ model = models.Person
+ redirect_url = "/person_modification/selec-person_modification?open_item={last_id}"
+ form_datas = [
+ WizardTestFormData(
+ "Add a person",
+ form_datas={
+ "identity": {
+ "surname": "Forname",
+ "name": "name",
+ "title": None,
+ "person_types": [],
+ }
+ },
+ ),
+ ]
+
+ def pre_wizard(self):
+ self.number = models.Person.objects.count()
+ super().pre_wizard()
+
+ def post_wizard(self):
+ self.assertEqual(models.Person.objects.count(), self.number + 1)
+ person = models.Person.objects.order_by("-pk").all()[0]
+ self.assertEqual(person.surname, "Forname")
+ self.assertEqual(person.name, "name")
+
+
class AccountWizardTest(WizardTest, TestCase):
fixtures = [
FIXTURE_AUTH_PATH + "fixtures/initial_data-auth-fr.json",