##// END OF EJS Templates
made test for login page
marcink -
r461:e9562113 default
parent child Browse files
Show More
@@ -4,4 +4,42 b' class TestLoginController(TestController'
4
4
5 def test_index(self):
5 def test_index(self):
6 response = self.app.get(url(controller='login', action='index'))
6 response = self.app.get(url(controller='login', action='index'))
7 assert response.status == '200 OK','Wrong response from login page'
7 # Test response...
8 # Test response...
9
10 def test_login_admin_ok(self):
11 response = self.app.post(url(controller='login', action='index'),
12 {'username':'test_admin',
13 'password':'test'})
14 assert response.status == '302 Found','Wrong response code from login'
15
16 def test_login_regular_ok(self):
17 response = self.app.post(url(controller='login', action='index'),
18 {'username':'test_admin',
19 'password':'test'})
20 assert response.status == '302 Found','Wrong response code from login'
21
22
23 def test_login_ok_came_from(self):
24 test_came_from = '/_admin/users'
25 response = self.app.post(url(controller='login', action='index',came_from=test_came_from),
26 {'username':'test_admin',
27 'password':'test'})
28 assert response.status == '302 Found','Wrong response code from came from redirection'
29 response = response.follow()
30
31 assert response.status == '200 OK','Wrong response from login page'
32 assert 'Users administration' in response.body,'No proper title in response'
33
34
35 def test_login_wrong(self):
36 response = self.app.post(url(controller='login', action='index'),
37 {'username':'error',
38 'password':'test'})
39 assert response.status == '200 OK','Wrong response from login page'
40
41 assert 'invalid user name' in response.body,'No error username message in response'
42 assert 'invalid password' in response.body,'No error password message in response'
43
44
45 No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now