From 55f232d63907bb4a4a3cb5ad13823d91fd9b8b90 Mon Sep 17 00:00:00 2001 From: Raphael Odini Date: Wed, 12 Jun 2024 11:26:11 +0200 Subject: [PATCH] add constants --- lemarche/siaes/constants.py | 6 ++++++ lemarche/siaes/tests.py | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lemarche/siaes/constants.py b/lemarche/siaes/constants.py index c6a2c0f92..6b3340507 100644 --- a/lemarche/siaes/constants.py +++ b/lemarche/siaes/constants.py @@ -203,3 +203,9 @@ }, # groupements 1 } + + +# https://django-simple-history.readthedocs.io/en/latest/quick_start.html#what-is-django-simple-history-doing-behind-the-scenes +SIAE_HISTORY_TYPE_CREATE = "+" +SIAE_HISTORY_TYPE_UPDATE = "~" +SIAE_HISTORY_TYPE_DELETE = "-" diff --git a/lemarche/siaes/tests.py b/lemarche/siaes/tests.py index 6924d6e02..c43b249ea 100644 --- a/lemarche/siaes/tests.py +++ b/lemarche/siaes/tests.py @@ -576,7 +576,7 @@ def setUpTestData(cls): def test_history_object_on_create(self): self.assertEqual(self.siae_1.history.count(), 1) siae_1_create_history_item = self.siae_1.history.last() - self.assertEqual(siae_1_create_history_item.history_type, "+") + self.assertEqual(siae_1_create_history_item.history_type, siae_constants.SIAE_HISTORY_TYPE_CREATE) self.assertEqual(siae_1_create_history_item.name, self.siae_1.name) def test_history_object_on_update(self): @@ -584,10 +584,10 @@ def test_history_object_on_update(self): self.siae_2.save() self.assertEqual(self.siae_2.history.count(), 1 + 1) siae_2_create_history_item = self.siae_2.history.last() - self.assertEqual(siae_2_create_history_item.history_type, "+") + self.assertEqual(siae_2_create_history_item.history_type, siae_constants.SIAE_HISTORY_TYPE_CREATE) self.assertEqual(siae_2_create_history_item.brand, "") siae_2_update_history_item = self.siae_2.history.first() - self.assertEqual(siae_2_update_history_item.history_type, "~") + self.assertEqual(siae_2_update_history_item.history_type, siae_constants.SIAE_HISTORY_TYPE_UPDATE) self.assertEqual(siae_2_update_history_item.brand, self.siae_2.brand)