See #890: Ensure report handled_date is populated automatically when handling the report

This commit is contained in:
Eliot Berriot 2019-08-26 14:47:01 +02:00
commit 177f06cf2a
No known key found for this signature in database
GPG key ID: DD6965E2476E5C27
2 changed files with 32 additions and 1 deletions

View file

@ -0,0 +1,22 @@
def test_setting_report_handled_to_true_sets_handled_date(factories, now):
target = factories["music.Artist"]()
report = factories["moderation.Report"](target=target)
assert report.is_handled is False
assert report.handled_date is None
report.is_handled = True
report.save()
assert report.handled_date == now
def test_setting_report_handled_to_false_sets_handled_date_to_null(factories, now):
target = factories["music.Artist"]()
report = factories["moderation.Report"](
target=target, is_handled=True, handled_date=now
)
report.is_handled = False
report.save()
assert report.handled_date is None