Commit fe14c23a authored by Jelle van der Waa's avatar Jelle van der Waa 🚧
Browse files

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.
parent 8ce83c11
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)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment