@@ -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 )
0 commit comments