diff options
author | jelle van der Waa <jelle@vdwaa.nl> | 2018-09-08 17:40:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-08 17:40:27 +0200 |
commit | 90c5d589804ae6ab2b50058037a687730e6b019e (patch) | |
tree | 717f80363254a64af642f119707d8efd3379107a | |
parent | e4de4d3b07aa198e9589b9357a4f46ed8eb9eb66 (diff) | |
parent | 3cef83114803935ac29f1205a09a1a114b00c4d1 (diff) | |
download | archweb-90c5d589804ae6ab2b50058037a687730e6b019e.tar.gz archweb-90c5d589804ae6ab2b50058037a687730e6b019e.zip |
Merge pull request #139 from jelly/tests
Clean up models on tearDown.
-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] |