def test_login_success(self): self.set_post({'user_email': '*****@*****.**', 'user_password': '******'}) page = LoginPage(self.request, self.response) page.redirect = self.response.redirect page.post() html = self.response.out.getvalue() self.assertEqual(self.response.redirect_location, '/') self.assertTrue(AppDashboardHelper.DEV_APPSERVER_LOGIN_COOKIE in self.response.cookies)
def test_login_success(self): self.set_post({ 'user_email' : '*****@*****.**', 'user_password' : 'aaaaaa' }) page = LoginPage(self.request, self.response) page.redirect = self.response.redirect page.post() html = self.response.out.getvalue() self.assertEqual(self.response.redirect_location, '/') self.assertTrue(AppDashboardHelper.DEV_APPSERVER_LOGIN_COOKIE in self.response.cookies)
def test_login_fail(self): self.set_post({ 'user_email' : '*****@*****.**', 'user_password' : 'bbbbbb' }) page = LoginPage(self.request, self.response) page.redirect = self.response.redirect page.post() html = self.response.out.getvalue() self.assertTrue(re.search('<!-- FILE:templates/layouts/main.html -->', html)) self.assertTrue(re.search('<!-- FILE:templates/users/login.html -->', html)) self.assertTrue(re.search('Incorrect username / password combination. Please try again', html))
def test_login_success_redir(self): continue_url = 'http%3A//192.168.33.168%3A8080/_ah/login%3Fcontinue%3Dhttp%3A//192.168.33.168%3A8080/' self.set_post({ 'continue' : continue_url, 'user_email' : '*****@*****.**', 'user_password' : 'aaaaaa' }) page = LoginPage(self.request, self.response) page.redirect = self.response.redirect page.post() html = self.response.out.getvalue() self.assertTrue(re.search('/users/confirm\?continue=',self.response.redirect_location)) self.assertTrue(AppDashboardHelper.DEV_APPSERVER_LOGIN_COOKIE in self.response.cookies)
def test_login_page(self): continue_url = 'http%3A//192.168.33.168%3A8080/_ah/login%3Fcontinue%3Dhttp%3A//192.168.33.168%3A8080/' self.set_get({'continue': continue_url}) LoginPage(self.request, self.response).get() html = self.response.out.getvalue() self.assertTrue( re.search('<!-- FILE:templates/layouts/main.html -->', html)) self.assertTrue( re.search('<!-- FILE:templates/users/login.html -->', html)) self.assertTrue(re.search(continue_url, html))