Commit 15e4f753 authored by Jelle van der Waa's avatar Jelle van der Waa 🚧 Committed by Angel Velásquez
Browse files

releng: Add tests for a few views (#83)

Add a few simple tests for some of the releases views.
parent 73107e0a
import json
from django.test import TestCase
from releng.models import Release
class RelengViewTest(TestCase):
fixtures = ['releng/fixtures/release.json']
def setUp(self):
self.release = Release.objects.first()
def test_release_json(self):
version = self.release.version
response = self.client.get('/releng/releases/json/')
self.assertEqual(response.status_code, 200)
data = json.loads(response.content)
self.assertEqual(data['version'], 1)
release = data['releases'][0]
self.assertEqual(release['version'], version)
def test_netboot_page(self):
response = self.client.get('/releng/netboot/')
self.assertEqual(response.status_code, 200)
def test_release_torrent_not_found(self):
# TODO: Add torrent data to release fixture
version = self.release.version
response = self.client.get('/releng/releases/{}/torrent/'.format(version))
self.assertEqual(response.status_code, 404)
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