1+ # Copyright The IETF Trust 2013-2019, All Rights Reserved
12# -*- coding: utf-8 -*-
23from django .urls import reverse
34from ietf .utils .test_utils import TestCase
@@ -26,9 +27,7 @@ def test_search(self):
2627 post_data = {'group_acronym' :group .acronym ,'submit' :'Search' }
2728 self .client .login (username = "secretary" , password = "secretary+password" )
2829 response = self .client .post (url ,post_data ,follow = True )
29- #assert False, response.content
30- self .assertEqual (response .status_code , 200 )
31- self .assertTrue (group .acronym in response .content )
30+ self .assertContains (response , group .acronym )
3231
3332 # ------- Test Add -------- #
3433 def test_add_button (self ):
@@ -48,8 +47,7 @@ def test_add_group_invalid(self):
4847 'submit' :'Save' }
4948 self .client .login (username = "secretary" , password = "secretary+password" )
5049 response = self .client .post (url ,post_data )
51- self .assertEqual (response .status_code , 200 )
52- self .assertTrue ('This field is required' in response .content )
50+ self .assertContains (response , 'This field is required' )
5351
5452 def test_add_group_dupe (self ):
5553 group = GroupFactory ()
@@ -65,9 +63,7 @@ def test_add_group_dupe(self):
6563 'submit' :'Save' }
6664 self .client .login (username = "secretary" , password = "secretary+password" )
6765 response = self .client .post (url ,post_data )
68- #print response.content
69- self .assertEqual (response .status_code , 200 )
70- self .assertTrue ('Group with this Acronym already exists' in response .content )
66+ self .assertContains (response , 'Group with this Acronym already exists' )
7167
7268 def test_add_group_success (self ):
7369 area = GroupFactory (type_id = 'area' )
@@ -113,7 +109,7 @@ def test_edit_valid(self):
113109 self .client .login (username = "secretary" , password = "secretary+password" )
114110 response = self .client .post (url ,post_data ,follow = True )
115111 self .assertRedirects (response , target )
116- self .assertTrue ( 'changed successfully' in response . content )
112+ self .assertContains ( response , 'changed successfully' )
117113
118114 def test_edit_non_wg_group (self ):
119115 parent_sdo = GroupFactory .create (type_id = 'sdo' ,state_id = 'active' )
@@ -133,7 +129,7 @@ def test_edit_non_wg_group(self):
133129 self .client .login (username = "secretary" , password = "secretary+password" )
134130 response = self .client .post (url ,post_data ,follow = True )
135131 self .assertRedirects (response , target )
136- self .assertTrue ( 'changed successfully' in response . content )
132+ self .assertContains ( response , 'changed successfully' )
137133
138134 # ------- Test People -------- #
139135 def test_people_delete (self ):
@@ -161,4 +157,4 @@ def test_people_add(self):
161157 self .client .login (username = "secretary" , password = "secretary+password" )
162158 response = self .client .post (url ,post_data ,follow = True )
163159 self .assertRedirects (response , url )
164- self .assertTrue ( 'added successfully' in response . content )
160+ self .assertContains ( response , 'added successfully' )
0 commit comments