From 387ce32e6f3ff987e9ab3a046699537bf08cac90 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Wed, 28 Feb 2024 10:05:52 +0100 Subject: [PATCH] Restock detection - Improving test for restock IN STOCK -> OUT OF STOCK (#2219) --- changedetectionio/tests/restock/test_restock.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/changedetectionio/tests/restock/test_restock.py b/changedetectionio/tests/restock/test_restock.py index d00fed10..30528cd1 100644 --- a/changedetectionio/tests/restock/test_restock.py +++ b/changedetectionio/tests/restock/test_restock.py @@ -95,7 +95,7 @@ def test_restock_detection(client, live_server): # We should have a notification time.sleep(2) - assert os.path.isfile("test-datastore/notification.txt") + assert os.path.isfile("test-datastore/notification.txt"), "Notification received" os.unlink("test-datastore/notification.txt") # Default behaviour is to only fire notification when it goes OUT OF STOCK -> IN STOCK @@ -103,4 +103,9 @@ def test_restock_detection(client, live_server): set_original_response() client.get(url_for("form_watch_checknow"), follow_redirects=True) wait_for_all_checks(client) - assert not os.path.isfile("test-datastore/notification.txt") + assert not os.path.isfile("test-datastore/notification.txt"), "No notification should have fired when it went OUT OF STOCK by default" + + # BUT we should see that it correctly shows "not in stock" + res = client.get(url_for("index")) + assert b'not-in-stock' in res.data, "Correctly showing NOT IN STOCK in the list after it changed from IN STOCK" +