1+ # Copyright The IETF Trust 2013-2019, All Rights Reserved
12import datetime
23import os
34import shutil
@@ -60,8 +61,7 @@ def test_approvals(self):
6061 url = urlreverse ('ietf.secr.drafts.views.approvals' )
6162 self .client .login (username = "secretary" , password = "secretary+password" )
6263 response = self .client .get (url )
63- self .assertEqual (response .status_code , 200 )
64- self .assertTrue ('draft-dummy' in response .content )
64+ self .assertContains (response , 'draft-dummy' )
6565
6666 def test_edit (self ):
6767 draft = WgDraftFactory (states = [('draft' ,'active' ),('draft-stream-ietf' ,'wg-doc' ),('draft-iesg' ,'ad-eval' )], shepherd = EmailFactory ())
@@ -105,8 +105,7 @@ def test_search(self):
105105
106106 post = dict (filename = 'draft' ,state = 1 ,submit = 'submit' )
107107 response = self .client .post (url , post )
108- self .assertEqual (response .status_code , 200 )
109- self .assertTrue (draft .name in response .content )
108+ self .assertContains (response , draft .name )
110109
111110 def test_view (self ):
112111 draft = WgDraftFactory ()
@@ -141,8 +140,7 @@ def test_resurrect(self):
141140 subject = 'Resurrection of %s' % draft .get_base_name ()
142141 self .client .login (username = "secretary" , password = "secretary+password" )
143142 response = self .client .get (email_url )
144- self .assertEqual (response .status_code , 200 )
145- self .assertTrue ('<title>Drafts - Email</title>' in response .content )
143+ self .assertContains (response , '<title>Drafts - Email</title>' )
146144 q = PyQuery (response .content )
147145 self .assertEqual (q ("#id_subject" ).val (), subject )
148146 post_data = {
@@ -154,8 +152,7 @@ def test_resurrect(self):
154152 'submit' : 'Save'
155153 }
156154 response = self .client .post (confirm_url , post_data )
157- self .assertEqual (response .status_code , 200 )
158- self .assertTrue ('<title>Drafts - Confirm</title>' in response .content )
155+ self .assertContains (response , '<title>Drafts - Confirm</title>' )
159156 self .assertEqual (response .context ['email' ]['subject' ], subject )
160157 response = self .client .post (do_action_url , post_data )
161158 self .assertRedirects (response , view_url )
@@ -193,8 +190,7 @@ def test_extend(self):
193190 response = self .client .post (url , extend_data )
194191 self .assertRedirects (response , email_url + '?' + urlencode (extend_data ))
195192 response = self .client .post (confirm_url , post_data )
196- self .assertEqual (response .status_code , 200 )
197- self .assertTrue ('<title>Drafts - Confirm</title>' in response .content )
193+ self .assertContains (response , '<title>Drafts - Confirm</title>' )
198194 self .assertEqual (response .context ['email' ]['subject' ], subject )
199195 response = self .client .post (do_action_url , post_data )
200196 self .assertRedirects (response , view_url )
@@ -227,8 +223,7 @@ def test_withdraw(self):
227223 response = self .client .post (url , withdraw_data )
228224 self .assertRedirects (response , email_url + '?' + urlencode (withdraw_data ))
229225 response = self .client .post (confirm_url , post_data )
230- self .assertEqual (response .status_code , 200 )
231- self .assertTrue ('<title>Drafts - Confirm</title>' in response .content )
226+ self .assertContains (response , '<title>Drafts - Confirm</title>' )
232227 self .assertEqual (response .context ['email' ]['subject' ], subject )
233228 response = self .client .post (do_action_url , post_data )
234229 self .assertRedirects (response , view_url )
0 commit comments