diff options
author | Jelle van der Waa <jelle@vdwaa.nl> | 2018-09-08 17:37:03 +0200 |
---|---|---|
committer | Jelle van der Waa <jelle@vdwaa.nl> | 2018-09-08 17:37:03 +0200 |
commit | 3cef83114803935ac29f1205a09a1a114b00c4d1 (patch) | |
tree | 717f80363254a64af642f119707d8efd3379107a /mirrors | |
parent | e4de4d3b07aa198e9589b9357a4f46ed8eb9eb66 (diff) | |
download | archweb-3cef83114803935ac29f1205a09a1a114b00c4d1.tar.gz archweb-3cef83114803935ac29f1205a09a1a114b00c4d1.zip |
Fix caching issue in test
Diffstat (limited to 'mirrors')
-rw-r--r-- | mirrors/tests/test_mirrorstatus.py | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/mirrors/tests/test_mirrorstatus.py b/mirrors/tests/test_mirrorstatus.py index b2d4d65f..503ad280 100644 --- a/mirrors/tests/test_mirrorstatus.py +++ b/mirrors/tests/test_mirrorstatus.py @@ -9,23 +9,18 @@ class MirrorStatusTest(TestCase): self.assertEqual(response.status_code, 200) def test_json_endpoint(self): - response = self.client.get('/mirrors/status/json/') - self.assertEqual(response.status_code, 200) - data = response.json() - self.assertEqual(data['urls'], []) - - mirror_url = create_mirror_url() - - # Verify that the cache works - response = self.client.get('/mirrors/status/json/') - self.assertEqual(response.status_code, 200) - data = response.json() - # Disables the cache_function's cache with self.settings(CACHES={'default': {'BACKEND': 'django.core.cache.backends.dummy.DummyCache'}}): response = self.client.get('/mirrors/status/json/') self.assertEqual(response.status_code, 200) data = response.json() + self.assertEqual(data['urls'], []) + + mirror_url = create_mirror_url() + + response = self.client.get('/mirrors/status/json/') + self.assertEqual(response.status_code, 200) + data = response.json() self.assertEqual(len(data['urls']), 1) mirror = data['urls'][0] |