summaryrefslogtreecommitdiffstats
path: root/mirrors
diff options
context:
space:
mode:
authorJelle van der Waa <jelle@vdwaa.nl>2018-03-25 19:48:47 +0200
committerJelle van der Waa <jelle@vdwaa.nl>2018-03-26 21:20:22 +0200
commit538fc2b626b68f7c8132916908aaaf0e98f53d74 (patch)
tree575dc78512ef2abb9c21446b1c4a9df374d15309 /mirrors
parent692d80d71e07a2d88199c9dd842779ef91582723 (diff)
downloadarchweb-538fc2b626b68f7c8132916908aaaf0e98f53d74.tar.gz
archweb-538fc2b626b68f7c8132916908aaaf0e98f53d74.zip
mirrors: Test mirror status with tier specified
Diffstat (limited to 'mirrors')
-rw-r--r--mirrors/tests/test_mirrorstatus.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/mirrors/tests/test_mirrorstatus.py b/mirrors/tests/test_mirrorstatus.py
index ff4d820e..f7864b66 100644
--- a/mirrors/tests/test_mirrorstatus.py
+++ b/mirrors/tests/test_mirrorstatus.py
@@ -34,3 +34,23 @@ class MirrorStatusTest(TestCase):
self.assertEqual(mirror['url'], mirror_url.url)
mirror_url.delete()
+
+ def test_json_tier(self):
+ response = self.client.get('/mirrors/status/tier/99/json/')
+ self.assertEqual(response.status_code, 404)
+
+ response = self.client.get('/mirrors/status/tier/1/json/')
+ self.assertEqual(response.status_code, 200)
+ data = json.loads(response.content)
+ self.assertEqual(data['urls'], [])
+
+ mirror_url = create_mirror_url()
+
+ # 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 = json.loads(response.content)
+ self.assertNotEqual(data['urls'], [])
+
+ mirror_url.delete()