Skip to content

Commit

Permalink
add a test case to make when changes has value it wont be overwritten…
Browse files Browse the repository at this point in the history
… by changes_text
  • Loading branch information
GreatBahram committed Jun 12, 2024
1 parent bec21f9 commit 904edb0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions auditlog_tests/test_two_step_json_migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,21 @@ def test_native_postgres(self):
self.assertEqual(errbuf, "")
self.assertIsNotNone(log_entry.changes)

def test_native_postgres_changes_not_overwritten(self):
# Arrange
log_entry = self.make_logentry()
log_entry.changes = original_changes = {"key": "value"}
log_entry.changes_text = '{"key": "new value"}'
log_entry.save()

# Act
outbuf, errbuf = self.call_command("-d=postgres")
log_entry.refresh_from_db()

# Assert
self.assertEqual(errbuf, "")
self.assertEqual(log_entry.changes, original_changes)

def test_native_unsupported(self):
# Arrange
log_entry = self.make_logentry()
Expand Down

0 comments on commit 904edb0

Please sign in to comment.