Skip to content

Commit 1b3e98d

Browse files
committed
Added simple tests for help and release pages.
- Legacy-Id: 9413
1 parent 24a2339 commit 1b3e98d

2 files changed

Lines changed: 30 additions & 18 deletions

File tree

ietf/help/tests_views.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
"""
2-
This file demonstrates two different styles of tests (one doctest and one
3-
unittest). These will both pass when you run "manage.py test".
4-
5-
Replace these with more appropriate tests for your application.
6-
"""
7-
81
from pyquery import PyQuery
92

103
from django.core.urlresolvers import reverse

ietf/release/tests.py

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,35 @@
1-
"""
2-
This file demonstrates writing tests using the unittest module. These will pass
3-
when you run "manage.py test".
1+
from pyquery import PyQuery
42

5-
Replace this with more appropriate tests for your application.
6-
"""
3+
from django.core.urlresolvers import reverse
4+
5+
import debug # pyflakes:ignore
76

87
from ietf.utils.test_utils import TestCase
98

9+
class ReleasePagesTest(TestCase):
10+
11+
def test_release(self):
12+
url = reverse('ietf.release.views.release')
13+
r = self.client.get(url)
14+
self.assertEqual(r.status_code, 200)
15+
q = PyQuery(r.content)
16+
releases = [ e.text.strip() for e in q('#content table td a') if e.text ]
17+
for num in ["2.00", "3.00", "4.00", "5.0.0"]:
18+
self.assertIn(num, releases)
19+
20+
def test_about(self):
21+
url = reverse('ietf.release.views.release')+"about"
22+
r = self.client.get(url)
23+
self.assertEqual(r.status_code, 200)
24+
q = PyQuery(r.content)
25+
text = q('#content').text()
26+
for word in ["About", "2.00", "3.00", "4.00", "5.0.0"]:
27+
self.assertIn(word, text)
28+
self.assertGreater(len(q('#content a')), 16)
29+
30+
def test_todo(self):
31+
url = reverse('ietf.release.views.release')+"todo"
32+
r = self.client.get(url)
33+
self.assertEqual(r.status_code, 200)
34+
1035

11-
class SimpleTest(TestCase):
12-
def test_basic_addition(self):
13-
"""
14-
Tests that 1 + 1 always equals 2.
15-
"""
16-
self.assertEqual(1 + 1, 2)

0 commit comments

Comments
 (0)