Skip to content

Commit

Permalink
Merge pull request #20 from legau/m2m-support
Browse files Browse the repository at this point in the history
Fix tests
  • Loading branch information
thijskramer authored Jun 14, 2022
2 parents 4b7538d + e57eba8 commit 52133fa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions simple_history/tests/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1958,7 +1958,7 @@ def test_bulk_add_remove(self):
self.assertEqual(prev_record.places.all().count(), 0)

# Remove all places but the first
self.poll.places.remove(*Place.objects.filter(id__gt=1))
self.poll.places.remove(*Place.objects.exclude(pk=self.place.pk))

self.assertEqual(self.poll.history.all().count(), 3)

Expand Down Expand Up @@ -2010,7 +2010,7 @@ def test_diff_against(self):

delta = add_record.diff_against(create_record)
expected_change = ModelChange(
"places", [], [{"pollwithmanytomany": 1, "place": 1}]
"places", [], [{"pollwithmanytomany": self.poll.pk, "place": self.place.pk}]
)
self.assertEqual(delta.changed_fields, ["places"])
self.assertEqual(delta.old_record, create_record)
Expand All @@ -2030,7 +2030,7 @@ def test_diff_against(self):
# Second and third should have the same diffs as first and second, but with
# old and new reversed
expected_change = ModelChange(
"places", [{"place": 1, "pollwithmanytomany": 1}], []
"places", [{"place": self.place.pk, "pollwithmanytomany": self.poll.pk}], []
)
delta = del_record.diff_against(add_record)
self.assertEqual(delta.changed_fields, ["places"])
Expand Down

0 comments on commit 52133fa

Please sign in to comment.