def test_newuser_success(self): self.set_post({ 'user_email' : '*****@*****.**', 'user_password' : 'aaaaaa', 'user_password_confirmation' : 'aaaaaa', }) page = NewUserPage(self.request, self.response) page.redirect = self.response.redirect page.post() self.assertTrue(AppDashboardHelper.DEV_APPSERVER_LOGIN_COOKIE in self.response.cookies) self.assertEqual(self.response.redirect_location, '/')
def test_newuser_page(self): NewUserPage(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/new.html -->', html))
def test_newuser_passwdnomatch(self): self.set_post({ 'user_email' : '*****@*****.**', 'user_password' : 'aaaaa', 'user_password_confirmation' : 'aaabbb', }) NewUserPage(self.request, self.response).post() html = self.response.out.getvalue() self.assertTrue(re.search('<!-- FILE:templates/layouts/main.html -->', html)) self.assertTrue(re.search('<!-- FILE:templates/users/new.html -->', html)) self.assertTrue(re.search('Passwords do not match.', html))
def test_newuser_shortpasswd(self): self.set_post({ 'user_email' : '*****@*****.**', 'user_password' : 'aaa', 'user_password_confirmation' : 'aaa', }) NewUserPage(self.request, self.response).post() html = self.response.out.getvalue() self.assertTrue(re.search('<!-- FILE:templates/layouts/main.html -->', html)) self.assertTrue(re.search('<!-- FILE:templates/users/new.html -->', html)) self.assertTrue(re.search('Password must be at least 6 characters long.', html))
def test_newuser_bademail(self): self.set_post({ 'user_email' : 'c@a', 'user_password' : 'aaaaaa', 'user_password_confirmation' : 'aaaaaa', }) NewUserPage(self.request, self.response).post() html = self.response.out.getvalue() self.assertTrue(re.search('<!-- FILE:templates/layouts/main.html -->', html)) self.assertTrue(re.search('<!-- FILE:templates/users/new.html -->', html)) self.assertTrue(re.search('Format must be [email protected].', html))