@@ -894,6 +894,26 @@ def test_cache_control_js(self):
894894 self .assertEqual (f .status_code , 200 )
895895 self .assertEqual (f .headers ['Cache-Control' ], 'public, max-age=1209600' )
896896
897+ def test_login_fail_then_succeed (self ):
898+ # Set up session to manage cookies <insert blue monster here>
899+ session = requests .Session ()
900+ session .headers .update ({'Origin' : 'http://localhost:9001' })
901+
902+ # login using form
903+ login = {"__login_name" : 'admin' , '__login_password' : 'bad_sekrit' ,
904+ "@action" : "login" }
905+ f = session .post (self .url_base ()+ '/' , data = login )
906+ # verify error message and no hello message in sidebar.
907+ self .assertIn ('class="error-message">Invalid login <br/ >' , f .text )
908+ self .assertNotIn ('<b>Hello, admin</b>' , f .text )
909+
910+ # login using form
911+ login = {"__login_name" : 'admin' , '__login_password' : 'sekrit' ,
912+ "@action" : "login" }
913+ f = session .post (self .url_base ()+ '/' , data = login )
914+ # look for change in text in sidebar post login
915+ self .assertIn ('<b>Hello, admin</b>' , f .text )
916+
897917 def test_new_issue_with_file_upload (self ):
898918 # Set up session to manage cookies <insert blue monster here>
899919 session = requests .Session ()
0 commit comments