Skip to content

Commit

Permalink
add constants
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Jun 12, 2024
1 parent c14acf4 commit 55f232d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions lemarche/siaes/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "-"
6 changes: 3 additions & 3 deletions lemarche/siaes/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,18 +576,18 @@ 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):
self.siae_2.brand = "test"
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)


Expand Down

0 comments on commit 55f232d

Please sign in to comment.