See #890: Ensure report handled_date is populated automatically when handling the report
This commit is contained in:
parent
b659eec4df
commit
177f06cf2a
2 changed files with 32 additions and 1 deletions
22
api/tests/moderation/test_models.py
Normal file
22
api/tests/moderation/test_models.py
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue