diff options
Diffstat (limited to 'mirrors/tests/test_mirrorlocations.py')
-rw-r--r-- | mirrors/tests/test_mirrorlocations.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/mirrors/tests/test_mirrorlocations.py b/mirrors/tests/test_mirrorlocations.py new file mode 100644 index 00000000..92751669 --- /dev/null +++ b/mirrors/tests/test_mirrorlocations.py @@ -0,0 +1,20 @@ +import json + +from django.test import TestCase + +from mirrors.models import CheckLocation + + +class MirrorLocationsTest(TestCase): + def setUp(self): + self.checklocation = CheckLocation.objects.create(hostname='arch.org', + source_ip='8.8.8.8', + country='US') + + def test_mirrorlocations_json(self): + response = self.client.get('/mirrors/locations/json/') + self.assertEqual(response.status_code, 200) + data = json.loads(response.content) + self.assertEqual(1, data['version']) + location = data['locations'][0]['country_code'] + self.assertEqual('US', location) |