Skip to content

Commit 13f3b4e

Browse files
committed
Add simple test for document stats
- Legacy-Id: 12631
1 parent 7dc370b commit 13f3b4e

2 files changed

Lines changed: 29 additions & 1 deletion

File tree

ietf/stats/tests.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,34 @@ def test_stats_index(self):
1212
r = self.client.get(url)
1313
self.assertEqual(r.status_code, 200)
1414

15+
def test_document_stats(self):
16+
make_test_data()
17+
18+
# check redirect
19+
url = urlreverse(ietf.stats.views.document_stats)
20+
21+
authors_url = urlreverse(ietf.stats.views.document_stats, kwargs={ "stats_type": "authors" })
22+
23+
r = self.client.get(url)
24+
self.assertEqual(r.status_code, 302)
25+
self.assertTrue(authors_url in r["Location"])
26+
27+
authors_all_url = urlreverse(ietf.stats.views.document_stats, kwargs={ "stats_type": "authors", "document_type": "all" })
28+
29+
r = self.client.get(authors_url)
30+
self.assertEqual(r.status_code, 302)
31+
self.assertTrue(authors_all_url in r["Location"])
32+
33+
# check various stats types
34+
for stats_type in ["authors"]:
35+
for document_type in ["all", "rfc", "draft"]:
36+
url = urlreverse(ietf.stats.views.document_stats, kwargs={ "stats_type": stats_type, "document_type": document_type })
37+
r = self.client.get(url)
38+
self.assertEqual(r.status_code, 200)
39+
q = PyQuery(r.content)
40+
self.assertTrue(q('#chart'))
41+
self.assertTrue(q('table.stats-data'))
42+
1543
def test_review_stats(self):
1644
doc = make_test_data()
1745
review_req = make_review_data(doc)

ietf/templates/stats/document_stats_authors.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ <h3>{{ stats_title }}</h3>
5454

5555
<h3>Data</h3>
5656

57-
<table class="table table-condensed">
57+
<table class="table table-condensed stats-data">
5858
<thead>
5959
<tr>
6060
<th>Authors</th>

0 commit comments

Comments
 (0)