summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJelle van der Waa <jelle@vdwaa.nl>2018-03-25 20:08:33 +0200
committerJelle van der Waa <jelle@vdwaa.nl>2018-03-26 21:20:25 +0200
commitfe14c23a886221c4fedb531a3a7e5454fa26397f (patch)
tree7f0029537fa9b446d1576de27ed96d5f09c6d1a2
parent8ce83c115ccd2010a4d5068d0483c753527ceade (diff)
downloadarchweb-fe14c23a886221c4fedb531a3a7e5454fa26397f.tar.gz
archweb-fe14c23a886221c4fedb531a3a7e5454fa26397f.zip
mirrors: Add tests for mirror detail urls
Add tests for mirror detail pages, the json url of the mirror detail page and the mirror's url detail page.
-rw-r--r--mirrors/tests/test_mirrors.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/mirrors/tests/test_mirrors.py b/mirrors/tests/test_mirrors.py
new file mode 100644
index 00000000..9258ad7a
--- /dev/null
+++ b/mirrors/tests/test_mirrors.py
@@ -0,0 +1,39 @@
+import json
+
+from django.test import TestCase
+
+from mirrors.tests import create_mirror_url
+
+
+class MirrorTest(TestCase):
+
+ def test_details(self):
+ response = self.client.get('/mirrors/nothing/')
+ self.assertEqual(response.status_code, 404)
+
+ mirror_url = create_mirror_url()
+ url = mirror_url.mirror.get_absolute_url()
+
+ response = self.client.get(url)
+ self.assertEqual(response.status_code, 200)
+
+ # FIXME: request as mirror admin
+
+ def test_details_json(self):
+ response = self.client.get('/mirrors/nothing/json/')
+ self.assertEqual(response.status_code, 404)
+
+ mirror_url = create_mirror_url()
+ url = mirror_url.mirror.get_absolute_url()
+
+ response = self.client.get(url + 'json/')
+ self.assertEqual(response.status_code, 200)
+ data = json.loads(response.content)
+ self.assertNotEqual(data['urls'], [])
+
+ def test_url_details(self):
+ mirror_url = create_mirror_url()
+ url = mirror_url.mirror.get_absolute_url()
+
+ response = self.client.get(url + '{}/'.format(mirror_url.id))
+ self.assertEqual(response.status_code, 200)