mirrors: Add basic status code test for /mirrorlist/tier

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
This commit is contained in:
Johannes Löthberg 2018-05-05 21:35:58 +02:00
parent a9802cd379
commit cf0ac9320d

View File

@ -1,6 +1,7 @@
from django.test import TestCase
from mirrors.tests import create_mirror_url
from mirrors.models import Mirror
class MirrorListTest(TestCase):
@ -14,6 +15,15 @@ def test_mirrorlist(self):
response = self.client.get('/mirrorlist/')
self.assertEqual(response.status_code, 200)
def test_mirrorlist_tier(self):
response = self.client.get('/mirrorlist/tier/1/')
self.assertEqual(response.status_code, 200)
def test_mirrorlist_tier(self):
last_tier = Mirror.TIER_CHOICES[-1][0]
response = self.client.get('/mirrorlist/tier/{}/'.format(last_tier + 1))
self.assertEqual(response.status_code, 404)
def test_mirrorlist_all(self):
response = self.client.get('/mirrorlist/all/')
self.assertEqual(response.status_code, 200)