Added simple tests for help and release pages.
- Legacy-Id: 9413
This commit is contained in:
parent
24a2339b99
commit
1b3e98dd31
|
@ -1,10 +1,3 @@
|
|||
"""
|
||||
This file demonstrates two different styles of tests (one doctest and one
|
||||
unittest). These will both pass when you run "manage.py test".
|
||||
|
||||
Replace these with more appropriate tests for your application.
|
||||
"""
|
||||
|
||||
from pyquery import PyQuery
|
||||
|
||||
from django.core.urlresolvers import reverse
|
||||
|
|
|
@ -1,16 +1,35 @@
|
|||
"""
|
||||
This file demonstrates writing tests using the unittest module. These will pass
|
||||
when you run "manage.py test".
|
||||
from pyquery import PyQuery
|
||||
|
||||
Replace this with more appropriate tests for your application.
|
||||
"""
|
||||
from django.core.urlresolvers import reverse
|
||||
|
||||
import debug # pyflakes:ignore
|
||||
|
||||
from ietf.utils.test_utils import TestCase
|
||||
|
||||
class ReleasePagesTest(TestCase):
|
||||
|
||||
def test_release(self):
|
||||
url = reverse('ietf.release.views.release')
|
||||
r = self.client.get(url)
|
||||
self.assertEqual(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
releases = [ e.text.strip() for e in q('#content table td a') if e.text ]
|
||||
for num in ["2.00", "3.00", "4.00", "5.0.0"]:
|
||||
self.assertIn(num, releases)
|
||||
|
||||
def test_about(self):
|
||||
url = reverse('ietf.release.views.release')+"about"
|
||||
r = self.client.get(url)
|
||||
self.assertEqual(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
text = q('#content').text()
|
||||
for word in ["About", "2.00", "3.00", "4.00", "5.0.0"]:
|
||||
self.assertIn(word, text)
|
||||
self.assertGreater(len(q('#content a')), 16)
|
||||
|
||||
def test_todo(self):
|
||||
url = reverse('ietf.release.views.release')+"todo"
|
||||
r = self.client.get(url)
|
||||
self.assertEqual(r.status_code, 200)
|
||||
|
||||
|
||||
class SimpleTest(TestCase):
|
||||
def test_basic_addition(self):
|
||||
"""
|
||||
Tests that 1 + 1 always equals 2.
|
||||
"""
|
||||
self.assertEqual(1 + 1, 2)
|
||||
|
|
Loading…
Reference in a new issue