forked from adamlaska/datatracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests.py
More file actions
47 lines (35 loc) · 1.51 KB
/
tests.py
File metadata and controls
47 lines (35 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Copyright The IETF Trust 2012-2020, All Rights Reserved
# -*- coding: utf-8 -*-
from pyquery import PyQuery
from django.urls 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', kwargs={'version':'6.0.0'})
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_stats(self):
url = reverse('ietf.release.views.stats')
r = self.client.get(url)
q = PyQuery(r.content)
# grab the script element text, split off the json data
s = q('#coverage-data').text()
self.assertIn("type: 'line',", s)
self.assertIn('"data": [[1426018457000, ', s)
s = q('#frequency-data').text()
self.assertIn("type: 'column',", s)
self.assertIn('"data": [[2007, 7], ', s)