Restock detection - Improving test for restock IN STOCK -> OUT OF STOCK (#2219)

pull/2232/head
dgtlmoon 10 months ago committed by GitHub
parent 6b9a788d75
commit 387ce32e6f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -95,7 +95,7 @@ def test_restock_detection(client, live_server):
# We should have a notification # We should have a notification
time.sleep(2) 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") os.unlink("test-datastore/notification.txt")
# Default behaviour is to only fire notification when it goes OUT OF STOCK -> IN STOCK # 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() set_original_response()
client.get(url_for("form_watch_checknow"), follow_redirects=True) client.get(url_for("form_watch_checknow"), follow_redirects=True)
wait_for_all_checks(client) 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"

Loading…
Cancel
Save