mirrors: Test mirror status with tier specified
This commit is contained in:
parent
692d80d71e
commit
538fc2b626
@ -34,3 +34,23 @@ def test_json_endpoint(self):
|
|||||||
self.assertEqual(mirror['url'], mirror_url.url)
|
self.assertEqual(mirror['url'], mirror_url.url)
|
||||||
|
|
||||||
mirror_url.delete()
|
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()
|
||||||
|
Loading…
Reference in New Issue
Block a user