From 013cbcabd44e6a283045ba57d4f87ab0132e46cc Mon Sep 17 00:00:00 2001 From: Leigh Morresi <275001+dgtlmoon@users.noreply.github.com> Date: Sat, 27 Feb 2021 09:37:40 +0100 Subject: [PATCH] Clean up after test case --- backend/store.py | 5 ++++- backend/tests/test_backend.py | 2 ++ backend/tests/test_ignore_text.py | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/backend/store.py b/backend/store.py index b5e936ec..752a39de 100644 --- a/backend/store.py +++ b/backend/store.py @@ -157,7 +157,10 @@ class ChangeDetectionStore: def delete(self, uuid): with self.lock: - del (self.__data['watching'][uuid]) + if uuid == 'all': + self.__data['watching'] = {} + else: + del (self.__data['watching'][uuid]) self.needs_write = True def url_exists(self, url): diff --git a/backend/tests/test_backend.py b/backend/tests/test_backend.py index dac5aa5d..9ccc049e 100644 --- a/backend/tests/test_backend.py +++ b/backend/tests/test_backend.py @@ -119,3 +119,5 @@ def test_check_basic_change_detection_functionality(client, live_server): res = client.get(url_for("index")) assert b'unviewed' in res.data + res = client.get(url_for("api_delete", uuid="all"), follow_redirects=True) + assert b'Deleted' in res.data diff --git a/backend/tests/test_ignore_text.py b/backend/tests/test_ignore_text.py index da72b71e..69489169 100644 --- a/backend/tests/test_ignore_text.py +++ b/backend/tests/test_ignore_text.py @@ -124,4 +124,6 @@ def test_check_ignore_text_functionality(client, live_server): assert b'unviewed' not in res.data assert b'/test-endpoint' in res.data + res = client.get(url_for("api_delete", uuid="all"), follow_redirects=True) + assert b'Deleted' in res.data