From 2384af2ae35b123c39a5d0fc414527d3590aad2e Mon Sep 17 00:00:00 2001 From: Martin Burchell <martinb@aptivate.org> Date: Wed, 29 Jul 2015 15:40:56 +0100 Subject: [PATCH] Added another last modified update test This one covers the case where an item is removed from a term. --- django/website/data_layer/tests/item_tests.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/django/website/data_layer/tests/item_tests.py b/django/website/data_layer/tests/item_tests.py index 8259a410..c2456abc 100644 --- a/django/website/data_layer/tests/item_tests.py +++ b/django/website/data_layer/tests/item_tests.py @@ -87,3 +87,15 @@ def test_last_modified_date_updates_on_category_item_add( term.items.add(item) assert num_updates(orig_last_modified, last_modified(item)) == 1 + + +@pytest.mark.django_db +def test_last_modified_date_updates_on_category_item_delete( + item, mock_time_now): + with patch('django.utils.timezone.now', new=mock_time_now): + term = TermFactory() + term.items.add(item) + orig_last_modified = last_modified(item) + term.items.remove(item) + + assert num_updates(orig_last_modified, last_modified(item)) == 1 -- GitLab