@@ -140,7 +140,7 @@ def test_private_index_post_accept(self):
140140 r = self .client .post (self .private_index_url , test_data )
141141 self .assertEqual (r .status_code , 200 )
142142 q = PyQuery (r .content )
143- self .assertNotEqual (q ('p .alert.alert -success' ), [] )
143+ self .assertTrue (q ('.alert-success' ))
144144 self .assertEqual (NomineePosition .objects .filter (state = 'accepted' ).count (), 1 )
145145 self .client .logout ()
146146
@@ -152,7 +152,7 @@ def test_private_index_post_decline(self):
152152 r = self .client .post (self .private_index_url , test_data )
153153 self .assertEqual (r .status_code , 200 )
154154 q = PyQuery (r .content )
155- self .assertNotEqual (q ('p .alert.alert -success' ), [] )
155+ self .assertTrue (q ('.alert-success' ))
156156 self .assertEqual (NomineePosition .objects .filter (state = 'declined' ).count (), 1 )
157157 self .client .logout ()
158158
@@ -164,7 +164,7 @@ def test_private_index_post_pending(self):
164164 r = self .client .post (self .private_index_url , test_data )
165165 self .assertEqual (r .status_code , 200 )
166166 q = PyQuery (r .content )
167- self .assertNotEqual (q ('p .alert.alert -success' ), [] )
167+ self .assertTrue (q ('.alert-success' ))
168168 self .assertEqual (NomineePosition .objects .filter (state = 'pending' ).count (), 1 )
169169 self .client .logout ()
170170
@@ -1645,7 +1645,9 @@ def do_common_work(self,url,expected_form):
16451645 response = self .client .get (url )
16461646 self .assertEqual (response .status_code ,200 )
16471647 q = PyQuery (response .content )
1648- self .assertTrue (any (['not yet' in x .text for x in q ('.alert-warning' )]))
1648+ text_bits = [x .xpath ('./text()' ) for x in q ('.alert-warning' )]
1649+ flat_text_bits = [item for sublist in text_bits for item in sublist ]
1650+ self .assertTrue (any (['not yet' in y for y in flat_text_bits ]))
16491651 self .assertEqual (bool (q ('form:not(.navbar-form)' )),expected_form )
16501652 self .client .logout ()
16511653
0 commit comments