summaryrefslogtreecommitdiff
path: root/mirrors/tests/test_mirrorlist.py
diff options
context:
space:
mode:
Diffstat (limited to 'mirrors/tests/test_mirrorlist.py')
-rw-r--r--mirrors/tests/test_mirrorlist.py44
1 files changed, 44 insertions, 0 deletions
diff --git a/mirrors/tests/test_mirrorlist.py b/mirrors/tests/test_mirrorlist.py
new file mode 100644
index 00000000..b382b834
--- /dev/null
+++ b/mirrors/tests/test_mirrorlist.py
@@ -0,0 +1,44 @@
+from django.test import TestCase
+
+from mirrors.tests import create_mirror_url
+
+
+class MirrorListTest(TestCase):
+ def setUp(self):
+ self.mirror_url = create_mirror_url()
+
+ def tearDown(self):
+ self.mirror_url.delete()
+
+ def test_mirrorlist(self):
+ response = self.client.get('/mirrorlist/')
+ self.assertEqual(response.status_code, 200)
+
+ def test_mirrorlist(self):
+ response = self.client.get('/mirrorlist/')
+ self.assertEqual(response.status_code, 200)
+
+ def test_mirrorlist_all(self):
+ response = self.client.get('/mirrorlist/all/')
+ self.assertEqual(response.status_code, 200)
+ self.assertIn(self.mirror_url.hostname, response.content)
+
+ def test_mirrorlist_all_http(self):
+ response = self.client.get('/mirrorlist/all/http/')
+ self.assertEqual(response.status_code, 200)
+ self.assertIn(self.mirror_url.hostname, response.content)
+
+ def test_mirrorlist_all_https(self):
+ response = self.client.get('/mirrorlist/all/https/')
+ self.assertEqual(response.status_code, 404)
+ # TODO: test 200 case
+
+ def test_mirrorlist_filter(self):
+ response = self.client.get('/mirrorlist/?country=all&protocol=http&ip_version=4')
+ self.assertEqual(response.status_code, 200)
+ self.assertIn(self.mirror_url.hostname, response.content)
+
+ def test_generate(self):
+ response = self.client.get('/mirrorlist/?country=all&protocol=http&ip_version=4')
+ self.assertEqual(response.status_code, 200)
+ self.assertIn(self.mirror_url.hostname, response.content)