def testLoginHandlerCookieFaculty(self, mock): user = User() user.Fname = "Matt" user.Lname = "K" user.email = "*****@*****.**" user.password = "******" user.isInstructor = True main.u = user user.put() request = webapp2.Request.blank('/login') request.cookies['uname'] = "*****@*****.**" response = request.get_response(main.app) mock.assert_called_with('Faculty_landing.html')
def testMainHandlerCookie(self, mock_set_cookie, mock_redir): user = User() user.Fname = "Matt" user.Lname = "K" user.email = "*****@*****.**" user.password = "******" user.put() request = webapp2.Request.blank('/home', POST={ "user_email": "*****@*****.**", "pass_word": "KMatt" }) request.method = 'POST' mock_redir.return_value = None response = request.get_response(main.app) mock_set_cookie.assert_called_with('uname', user.email, path='/') self.assertEqual(main.error, "") mock_redir.assert_called_with('/login')