annotate rhodecode/tests/functional/test_login.py @ 723:bf26b46e82d6 beta

some tests update
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 18 Nov 2010 23:11:51 +0100
parents 7486da5f0628
children f1629c0c28cc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
547
1e757ac98988 renamed project to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents: 534
diff changeset
1 from rhodecode.tests import *
1e757ac98988 renamed project to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents: 534
diff changeset
2 from rhodecode.model.db import User
1e757ac98988 renamed project to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents: 534
diff changeset
3 from rhodecode.lib.auth import check_password
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
4
188
8337dd6492a9 logins controller test
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
5
8337dd6492a9 logins controller test
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
6 class TestLoginController(TestController):
8337dd6492a9 logins controller test
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
7
8337dd6492a9 logins controller test
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
8 def test_index(self):
8337dd6492a9 logins controller test
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
9 response = self.app.get(url(controller='login', action='index'))
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
10 assert response.status == '200 OK', 'Wrong response from login page got %s' % response.status
188
8337dd6492a9 logins controller test
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
11 # Test response...
461
e95621133eb6 made test for login page
Marcin Kuzminski <marcin@python-works.com>
parents: 188
diff changeset
12
e95621133eb6 made test for login page
Marcin Kuzminski <marcin@python-works.com>
parents: 188
diff changeset
13 def test_login_admin_ok(self):
e95621133eb6 made test for login page
Marcin Kuzminski <marcin@python-works.com>
parents: 188
diff changeset
14 response = self.app.post(url(controller='login', action='index'),
e95621133eb6 made test for login page
Marcin Kuzminski <marcin@python-works.com>
parents: 188
diff changeset
15 {'username':'test_admin',
534
12c976209b2e fixed test for new version 100% test are ok
Marcin Kuzminski <marcin@python-works.com>
parents: 533
diff changeset
16 'password':'test12'})
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
17 assert response.status == '302 Found', 'Wrong response code from login got %s' % response.status
548
b75b77ef649d renamed hg_app to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
18 assert response.session['rhodecode_user'].username == 'test_admin', 'wrong logged in user'
462
298546182b41 more test suites on login, fixed strange detached instance bug found during in tests.
Marcin Kuzminski <marcin@python-works.com>
parents: 461
diff changeset
19 response = response.follow()
688
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 659
diff changeset
20 assert '%s repository' % HG_REPO in response.body
659
758f64f3fbda extended repo creation by repo type. fixed fork creation to maintain repo type.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
21
461
e95621133eb6 made test for login page
Marcin Kuzminski <marcin@python-works.com>
parents: 188
diff changeset
22 def test_login_regular_ok(self):
e95621133eb6 made test for login page
Marcin Kuzminski <marcin@python-works.com>
parents: 188
diff changeset
23 response = self.app.post(url(controller='login', action='index'),
462
298546182b41 more test suites on login, fixed strange detached instance bug found during in tests.
Marcin Kuzminski <marcin@python-works.com>
parents: 461
diff changeset
24 {'username':'test_regular',
534
12c976209b2e fixed test for new version 100% test are ok
Marcin Kuzminski <marcin@python-works.com>
parents: 533
diff changeset
25 'password':'test12'})
533
53aa1ee1af86 updated tests for new version 6char password etc...
Marcin Kuzminski <marcin@python-works.com>
parents: 483
diff changeset
26 print response
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
27 assert response.status == '302 Found', 'Wrong response code from login got %s' % response.status
548
b75b77ef649d renamed hg_app to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
28 assert response.session['rhodecode_user'].username == 'test_regular', 'wrong logged in user'
462
298546182b41 more test suites on login, fixed strange detached instance bug found during in tests.
Marcin Kuzminski <marcin@python-works.com>
parents: 461
diff changeset
29 response = response.follow()
688
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 659
diff changeset
30 assert '%s repository' % HG_REPO in response.body
462
298546182b41 more test suites on login, fixed strange detached instance bug found during in tests.
Marcin Kuzminski <marcin@python-works.com>
parents: 461
diff changeset
31 assert '<a title="Admin" href="/_admin">' not in response.body
659
758f64f3fbda extended repo creation by repo type. fixed fork creation to maintain repo type.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
32
461
e95621133eb6 made test for login page
Marcin Kuzminski <marcin@python-works.com>
parents: 188
diff changeset
33 def test_login_ok_came_from(self):
e95621133eb6 made test for login page
Marcin Kuzminski <marcin@python-works.com>
parents: 188
diff changeset
34 test_came_from = '/_admin/users'
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
35 response = self.app.post(url(controller='login', action='index', came_from=test_came_from),
461
e95621133eb6 made test for login page
Marcin Kuzminski <marcin@python-works.com>
parents: 188
diff changeset
36 {'username':'test_admin',
534
12c976209b2e fixed test for new version 100% test are ok
Marcin Kuzminski <marcin@python-works.com>
parents: 533
diff changeset
37 'password':'test12'})
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
38 assert response.status == '302 Found', 'Wrong response code from came from redirection'
461
e95621133eb6 made test for login page
Marcin Kuzminski <marcin@python-works.com>
parents: 188
diff changeset
39 response = response.follow()
659
758f64f3fbda extended repo creation by repo type. fixed fork creation to maintain repo type.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
40
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
41 assert response.status == '200 OK', 'Wrong response from login page got %s' % response.status
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
42 assert 'Users administration' in response.body, 'No proper title in response'
659
758f64f3fbda extended repo creation by repo type. fixed fork creation to maintain repo type.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
43
758f64f3fbda extended repo creation by repo type. fixed fork creation to maintain repo type.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
44
533
53aa1ee1af86 updated tests for new version 6char password etc...
Marcin Kuzminski <marcin@python-works.com>
parents: 483
diff changeset
45 def test_login_short_password(self):
461
e95621133eb6 made test for login page
Marcin Kuzminski <marcin@python-works.com>
parents: 188
diff changeset
46 response = self.app.post(url(controller='login', action='index'),
e95621133eb6 made test for login page
Marcin Kuzminski <marcin@python-works.com>
parents: 188
diff changeset
47 {'username':'error',
e95621133eb6 made test for login page
Marcin Kuzminski <marcin@python-works.com>
parents: 188
diff changeset
48 'password':'test'})
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
49 assert response.status == '200 OK', 'Wrong response from login page'
567
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 549
diff changeset
50 print response.body
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 549
diff changeset
51 assert 'Enter 6 characters or more' in response.body, 'No error password message in response'
533
53aa1ee1af86 updated tests for new version 6char password etc...
Marcin Kuzminski <marcin@python-works.com>
parents: 483
diff changeset
52
53aa1ee1af86 updated tests for new version 6char password etc...
Marcin Kuzminski <marcin@python-works.com>
parents: 483
diff changeset
53 def test_login_wrong_username_password(self):
53aa1ee1af86 updated tests for new version 6char password etc...
Marcin Kuzminski <marcin@python-works.com>
parents: 483
diff changeset
54 response = self.app.post(url(controller='login', action='index'),
53aa1ee1af86 updated tests for new version 6char password etc...
Marcin Kuzminski <marcin@python-works.com>
parents: 483
diff changeset
55 {'username':'error',
53aa1ee1af86 updated tests for new version 6char password etc...
Marcin Kuzminski <marcin@python-works.com>
parents: 483
diff changeset
56 'password':'test12'})
53aa1ee1af86 updated tests for new version 6char password etc...
Marcin Kuzminski <marcin@python-works.com>
parents: 483
diff changeset
57 assert response.status == '200 OK', 'Wrong response from login page'
659
758f64f3fbda extended repo creation by repo type. fixed fork creation to maintain repo type.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
58
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
59 assert 'invalid user name' in response.body, 'No error username message in response'
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
60 assert 'invalid password' in response.body, 'No error password message in response'
659
758f64f3fbda extended repo creation by repo type. fixed fork creation to maintain repo type.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
61
723
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
62 #==========================================================================
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
63 # REGISTRATIONS
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
64 #==========================================================================
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
65 def test_register(self):
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
66 response = self.app.get(url(controller='login', action='register'))
549
f99075170eb4 more renames for rhode code !!
Marcin Kuzminski <marcin@python-works.com>
parents: 548
diff changeset
67 assert 'Sign Up to rhodecode' in response.body, 'wrong page for user registration'
659
758f64f3fbda extended repo creation by repo type. fixed fork creation to maintain repo type.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
68
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
69 def test_register_err_same_username(self):
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
70 response = self.app.post(url(controller='login', action='register'),
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
71 {'username':'test_admin',
723
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
72 'password':'test12',
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
73 'password_confirmation':'test12',
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
74 'email':'goodmail@domain.com',
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
75 'name':'test',
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
76 'lastname':'test'})
659
758f64f3fbda extended repo creation by repo type. fixed fork creation to maintain repo type.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
77
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
78 assert response.status == '200 OK', 'Wrong response from register page got %s' % response.status
659
758f64f3fbda extended repo creation by repo type. fixed fork creation to maintain repo type.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
79 assert 'This username already exists' in response.body
758f64f3fbda extended repo creation by repo type. fixed fork creation to maintain repo type.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
80
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
81 def test_register_err_wrong_data(self):
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
82 response = self.app.post(url(controller='login', action='register'),
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
83 {'username':'xs',
723
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
84 'password':'test',
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
85 'password_confirmation':'test',
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
86 'email':'goodmailm',
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
87 'name':'test',
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
88 'lastname':'test'})
659
758f64f3fbda extended repo creation by repo type. fixed fork creation to maintain repo type.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
89
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
90 assert response.status == '200 OK', 'Wrong response from register page got %s' % response.status
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
91 assert 'An email address must contain a single @' in response.body
533
53aa1ee1af86 updated tests for new version 6char password etc...
Marcin Kuzminski <marcin@python-works.com>
parents: 483
diff changeset
92 assert 'Please enter a value' in response.body
659
758f64f3fbda extended repo creation by repo type. fixed fork creation to maintain repo type.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
93
758f64f3fbda extended repo creation by repo type. fixed fork creation to maintain repo type.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
94
723
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
95 def test_register_special_chars(self):
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
96 response = self.app.post(url(controller='login', action='register'),
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
97 {'username':'xxxaxn',
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
98 'password':'ąćźżąśśśś',
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
99 'password_confirmation':'ąćźżąśśśś',
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
100 'email':'goodmailm',
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
101 'name':'test',
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
102 'lastname':'test@test.plx'})
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
103
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
104 assert response.status == '200 OK', 'Wrong response from register page got %s' % response.status
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
105 assert 'Invalid characters in password' in response.body
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
106
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
107
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
108 def test_register_password_mismatch(self):
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
109 response = self.app.post(url(controller='login', action='register'),
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
110 {'username':'xs',
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
111 'password':'123qwe',
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
112 'password_confirmation':'qwe123',
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
113 'email':'goodmailm',
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
114 'name':'test',
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
115 'lastname':'test@test.plxa'})
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
116
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
117 assert response.status == '200 OK', 'Wrong response from register page got %s' % response.status
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
118 assert 'Password do not match' in response.body
659
758f64f3fbda extended repo creation by repo type. fixed fork creation to maintain repo type.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
119
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
120 def test_register_ok(self):
473
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 463
diff changeset
121 username = 'test_regular4'
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
122 password = 'qweqwe'
483
a9e50dce3081 Removed config names from whoosh and celery,
Marcin Kuzminski <marcin@python-works.com>
parents: 473
diff changeset
123 email = 'marcin@test.com'
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
124 name = 'testname'
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
125 lastname = 'testlastname'
659
758f64f3fbda extended repo creation by repo type. fixed fork creation to maintain repo type.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
126
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
127 response = self.app.post(url(controller='login', action='register'),
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
128 {'username':username,
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
129 'password':password,
723
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
130 'password_confirmation':password,
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
131 'email':email,
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
132 'name':name,
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
133 'lastname':lastname})
659
758f64f3fbda extended repo creation by repo type. fixed fork creation to maintain repo type.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
134 assert response.status == '302 Found', 'Wrong response from register page got %s' % response.status
549
f99075170eb4 more renames for rhode code !!
Marcin Kuzminski <marcin@python-works.com>
parents: 548
diff changeset
135 assert 'You have successfully registered into rhodecode' in response.session['flash'][0], 'No flash message about user registration'
659
758f64f3fbda extended repo creation by repo type. fixed fork creation to maintain repo type.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
136
473
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 463
diff changeset
137 ret = self.sa.query(User).filter(User.username == 'test_regular4').one()
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
138 assert ret.username == username , 'field mismatch %s %s' % (ret.username, username)
483
a9e50dce3081 Removed config names from whoosh and celery,
Marcin Kuzminski <marcin@python-works.com>
parents: 473
diff changeset
139 assert check_password(password, ret.password) == True , 'password mismatch'
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
140 assert ret.email == email , 'field mismatch %s %s' % (ret.email, email)
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
141 assert ret.name == name , 'field mismatch %s %s' % (ret.name, name)
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
142 assert ret.lastname == lastname , 'field mismatch %s %s' % (ret.lastname, lastname)
659
758f64f3fbda extended repo creation by repo type. fixed fork creation to maintain repo type.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
143
758f64f3fbda extended repo creation by repo type. fixed fork creation to maintain repo type.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
144
758f64f3fbda extended repo creation by repo type. fixed fork creation to maintain repo type.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
145 def test_forgot_password_wrong_mail(self):
473
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 463
diff changeset
146 response = self.app.post(url(controller='login', action='password_reset'),
483
a9e50dce3081 Removed config names from whoosh and celery,
Marcin Kuzminski <marcin@python-works.com>
parents: 473
diff changeset
147 {'email':'marcin@wrongmail.org', })
659
758f64f3fbda extended repo creation by repo type. fixed fork creation to maintain repo type.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
148
483
a9e50dce3081 Removed config names from whoosh and celery,
Marcin Kuzminski <marcin@python-works.com>
parents: 473
diff changeset
149 assert "That e-mail address doesn't exist" in response.body, 'Missing error message about wrong email'
659
758f64f3fbda extended repo creation by repo type. fixed fork creation to maintain repo type.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
150
473
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 463
diff changeset
151 def test_forgot_password(self):
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 463
diff changeset
152 response = self.app.get(url(controller='login', action='password_reset'))
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 463
diff changeset
153 assert response.status == '200 OK', 'Wrong response from login page got %s' % response.status
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 463
diff changeset
154
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 463
diff changeset
155 username = 'test_password_reset_1'
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 463
diff changeset
156 password = 'qweqwe'
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 463
diff changeset
157 email = 'marcin@python-works.com'
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 463
diff changeset
158 name = 'passwd'
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 463
diff changeset
159 lastname = 'reset'
659
758f64f3fbda extended repo creation by repo type. fixed fork creation to maintain repo type.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
160
473
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 463
diff changeset
161 response = self.app.post(url(controller='login', action='register'),
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 463
diff changeset
162 {'username':username,
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 463
diff changeset
163 'password':password,
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 463
diff changeset
164 'email':email,
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 463
diff changeset
165 'name':name,
659
758f64f3fbda extended repo creation by repo type. fixed fork creation to maintain repo type.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
166 'lastname':lastname})
473
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 463
diff changeset
167 #register new user for email test
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 463
diff changeset
168 response = self.app.post(url(controller='login', action='password_reset'),
483
a9e50dce3081 Removed config names from whoosh and celery,
Marcin Kuzminski <marcin@python-works.com>
parents: 473
diff changeset
169 {'email':email, })
473
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 463
diff changeset
170 print response.session['flash']
549
f99075170eb4 more renames for rhode code !!
Marcin Kuzminski <marcin@python-works.com>
parents: 548
diff changeset
171 assert 'You have successfully registered into rhodecode' in response.session['flash'][0], 'No flash message about user registration'
473
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 463
diff changeset
172 assert 'Your new password was sent' in response.session['flash'][1], 'No flash message about password reset'
659
758f64f3fbda extended repo creation by repo type. fixed fork creation to maintain repo type.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
173
758f64f3fbda extended repo creation by repo type. fixed fork creation to maintain repo type.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
174
758f64f3fbda extended repo creation by repo type. fixed fork creation to maintain repo type.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
175