diff --git a/project/tests/test_view_clear_db.py b/project/tests/test_view_clear_db.py index 44ccbe60..1d50ecbd 100644 --- a/project/tests/test_view_clear_db.py +++ b/project/tests/test_view_clear_db.py @@ -20,3 +20,19 @@ def test_clear_all(self): response = self.client.post(silky_reverse("cleardb"), {"clear_all": "on"}) self.assertTrue(response.status_code == 200) self.assertEqual(models.Request.objects.count(), 0) + + +class TestViewClearDBAndDeleteProfiles(TestCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + SilkyConfig().SILKY_AUTHENTICATION = False + SilkyConfig().SILKY_AUTHORISATION = False + SilkyConfig().SILKY_DELETE_PROFILES = True + + def test_clear_all_and_delete_profiles(self): + RequestMinFactory.create() + self.assertEqual(models.Request.objects.count(), 1) + response = self.client.post(silky_reverse("cleardb"), {"clear_all": "on"}) + self.assertTrue(response.status_code == 200) + self.assertEqual(models.Request.objects.count(), 0) diff --git a/silk/config.py b/silk/config.py index fddbf9e2..8b237340 100644 --- a/silk/config.py +++ b/silk/config.py @@ -33,7 +33,8 @@ class SilkyConfig(metaclass=Singleton): 'SILKY_JSON_ENSURE_ASCII': True, 'SILKY_ANALYZE_QUERIES': False, 'SILKY_EXPLAIN_FLAGS': None, - 'SILKY_SENSITIVE_KEYS': {'username', 'api', 'token', 'key', 'secret', 'password', 'signature'} + 'SILKY_SENSITIVE_KEYS': {'username', 'api', 'token', 'key', 'secret', 'password', 'signature'}, + 'SILKY_DELETE_PROFILES': False } def _setup(self): diff --git a/silk/templates/silk/clear_db.html b/silk/templates/silk/clear_db.html index a073983b..297b3fd9 100644 --- a/silk/templates/silk/clear_db.html +++ b/silk/templates/silk/clear_db.html @@ -38,7 +38,7 @@