@@ -32,26 +32,20 @@ def test_downref_registry(self):
3232 # normal - get the table without the "Add downref" button
3333 self .client .login (username = "plain" , password = "plain+password" )
3434 r = self .client .get (url )
35- self .assertEqual (r .status_code , 200 )
36- content = unicontent (r )
37- self .assertTrue ('<h1>Downref registry</h1>' in content )
38- self .assertFalse ('Add downref' in content )
35+ self .assertContains (r , '<h1>Downref registry</h1>' )
36+ self .assertNotContains (r , 'Add downref' )
3937
4038 # secretariat - get the table with the "Add downref" button
4139 self .client .login (username = 'secretary' , password = 'secretary+password' )
4240 r = self .client .get (url )
43- self .assertEqual (r .status_code , 200 )
44- content = unicontent (r )
45- self .assertTrue ('<h1>Downref registry</h1>' in content )
46- self .assertTrue ('Add downref' in content )
41+ self .assertContains (r , '<h1>Downref registry</h1>' )
42+ self .assertContains (r , ('Add downref' )
4743
4844 # area director - get the table with the "Add downref" button
4945 self .client .login (username = 'ad' , password = 'ad+password' )
5046 r = self .client .get (url )
51- self .assertEqual (r .status_code , 200 )
52- content = unicontent (r )
53- self .assertTrue ('<h1>Downref registry</h1>' in content )
54- self .assertTrue ('Add downref' in content )
47+ self .assertContains (r , ('<h1>Downref registry</h1>' )
48+ self .assertContains (r , ('Add downref' )
5549
5650 def test_downref_registry_add (self ):
5751 url = urlreverse ('ietf.doc.views_downref.downref_registry_add' )
@@ -60,42 +54,32 @@ def test_downref_registry_add(self):
6054 # secretariat - get the form to add entries to the registry
6155 self .client .login (username = 'secretary' , password = 'secretary+password' )
6256 r = self .client .get (url )
63- self .assertEqual (r .status_code , 200 )
64- content = unicontent (r )
65- self .assertTrue ('<h1>Add entry to the downref registry</h1>' in content )
66- self .assertTrue ('Save downref' in content )
57+ self .assertContains (r , ('<h1>Add entry to the downref registry</h1>' )
58+ self .assertContains (r , ('Save downref' )
6759
6860 # area director - get the form to add entries to the registry
6961 self .client .login (username = 'ad' , password = 'ad+password' )
7062 r = self .client .get (url )
71- self .assertEqual (r .status_code , 200 )
72- content = unicontent (r )
73- self .assertTrue ('<h1>Add entry to the downref registry</h1>' in content )
74- self .assertTrue ('Save downref' in content )
63+ self .assertContains (r , ('<h1>Add entry to the downref registry</h1>' )
64+ self .assertContains (r , ('Save downref' )
7565
7666 # error - already in the downref registry
7767 r = self .client .post (url , dict (rfc = self .rfcalias .pk , drafts = (self .doc .pk , )))
78- self .assertEqual (r .status_code , 200 )
79- content = unicontent (r )
80- self .assertTrue ('Downref is already in the registry' in content )
68+ self .assertContains (r , ('Downref is already in the registry' )
8169
8270 # error - source is not in an approved state
8371 r = self .client .get (url )
8472 self .assertEqual (r .status_code , 200 )
8573 r = self .client .post (url , dict (rfc = self .rfcalias .pk , drafts = (self .draft .pk , )))
86- self .assertEqual (r .status_code , 200 )
87- content = unicontent (r )
88- self .assertTrue ('Draft is not yet approved' in content )
74+ self .assertContains (r , ('Draft is not yet approved' )
8975
9076 # error - the target is not a normative reference of the source
9177 self .draft .set_state (State .objects .get (used = True , type = "draft-iesg" , slug = "pub" ))
9278 r = self .client .get (url )
9379 self .assertEqual (r .status_code , 200 )
9480 r = self .client .post (url , dict (rfc = self .rfcalias .pk , drafts = (self .draft .pk , )))
95- self .assertEqual (r .status_code , 200 )
96- content = unicontent (r )
97- self .assertTrue ('There does not seem to be a normative reference to RFC' in content )
98- self .assertTrue ('Save downref anyway' in content )
81+ self .assertContains (r , ('There does not seem to be a normative reference to RFC' )
82+ self .assertContains (r , ('Save downref anyway' )
9983
10084 # normal - approve the document so the downref is now okay
10185 RelatedDocument .objects .create (source = self .draft , target = self .rfcalias , relationship_id = 'refnorm' )
@@ -108,9 +92,7 @@ def test_downref_registry_add(self):
10892 self .assertEqual (r .status_code , 302 )
10993 newurl = urlreverse ('ietf.doc.views_downref.downref_registry' )
11094 r = self .client .get (newurl )
111- self .assertEqual (r .status_code , 200 )
112- content = unicontent (r )
113- self .assertTrue ('<a href="/doc/draft-ietf-mars-test' in content )
95+ self .assertContains (r , ('<a href="/doc/draft-ietf-mars-test' )
11496 self .assertTrue (RelatedDocument .objects .filter (source = self .draft , target = self .rfcalias , relationship_id = 'downref-approval' ))
11597 self .assertEqual (self .draft .docevent_set .count (), draft_de_count_before + 1 )
11698 self .assertEqual (self .rfc .docevent_set .count (), rfc_de_count_before + 1 )
0 commit comments