diff --git a/qgis-app/plugins/tests/test_plugin_version_feedback.py b/qgis-app/plugins/tests/test_plugin_version_feedback.py index 8f7c7702..bdf17a26 100644 --- a/qgis-app/plugins/tests/test_plugin_version_feedback.py +++ b/qgis-app/plugins/tests/test_plugin_version_feedback.py @@ -10,6 +10,7 @@ from plugins.models import Plugin, PluginVersion, PluginVersionFeedback from plugins.views import version_feedback_notify from django.conf import settings +from django.core.cache import cache class SetupMixin: fixtures = ["fixtures/auth.json", "fixtures/simplemenu.json"] @@ -150,6 +151,9 @@ def test_staff_should_see_plugin_feedback_received(self): self.assertContains(response, "test plugin 1") self.assertNotContains(response, "test plugin 2") + # Clear django cache before sending another request + cache.clear() + # add feedback for plugin 2 PluginVersionFeedback.objects.create( version=self.version_2, @@ -170,6 +174,10 @@ def test_approved_plugin_should_not_show_in_feedback_received_list(self): list(response.context['object_list']), [self.plugin_1] ) + + # Clear django cache before sending another request + cache.clear() + self.version_1.approved = True self.version_1.save() response = self.client.get(self.url) @@ -186,6 +194,10 @@ def setUp(self): super().setUp() self.url = reverse("feedback_pending_plugins") + def tearDown(self): + # Clear cache after each test + cache.clear() + def test_non_staff_should_not_see_plugin_feedback_pending_list(self): response = self.client.get(self.url) self.assertEqual(response.status_code, 404) @@ -208,6 +220,9 @@ def test_staff_should_see_plugin_feedback_pending_list(self): self.assertContains(response, "test plugin 2") self.assertNotContains(response, "test plugin 1") + # Clear django cache before sending another request + cache.clear() + # add feedback for plugin 2 PluginVersionFeedback.objects.create( version=self.version_2,