[arch-projects] [archweb] [PATCH 2/2] mirrorlist: Complete /all/https success test case
Genki Sky
sky at genki.is
Sun Apr 22 01:59:10 UTC 2018
Also, remove test_generate(), as it was testing no more than
test_mirrorlist_filter() already was.
Signed-off-by: Genki Sky <sky at genki.is>
---
mirrors/tests/test_mirrorlist.py | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/mirrors/tests/test_mirrorlist.py b/mirrors/tests/test_mirrorlist.py
index 1ad3d8d..9e20812 100644
--- a/mirrors/tests/test_mirrorlist.py
+++ b/mirrors/tests/test_mirrorlist.py
@@ -25,9 +25,18 @@ def test_mirrorlist_all_http(self):
self.assertIn(self.mirror_url.hostname, response.content)
def test_mirrorlist_all_https(self):
+ # First test that without any https mirrors, we get a 404.
response = self.client.get('/mirrorlist/all/https/')
self.assertEqual(response.status_code, 404)
- # TODO: test 200 case
+
+ # Now, after adding an HTTPS mirror, we expect to succeed.
+ https_mirror_url = create_mirror_url(
+ name='https_mirror',
+ protocol='https',
+ url='https://wikipedia.org')
+ response = self.client.get('/mirrorlist/all/https/')
+ self.assertEqual(response.status_code, 200)
+ https_mirror_url.delete()
def test_mirrorlist_filter(self):
jp_mirror_url = create_mirror_url(
@@ -45,8 +54,3 @@ def test_mirrorlist_filter(self):
self.assertNotIn(self.mirror_url.hostname, response.content)
jp_mirror_url.delete()
-
- 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)
--
2.17.0
More information about the arch-projects
mailing list