annotate rhodecode/tests/functional/test_login.py @ 728:f1629c0c28cc beta

fixed bug in forms found due to testing, fixed tests
author Marcin Kuzminski <marcin@python-works.com>
date Sat, 20 Nov 2010 15:30:48 +0100
parents bf26b46e82d6
children c366b237c91d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
728
f1629c0c28cc fixed bug in forms found due to testing,
Marcin Kuzminski <marcin@python-works.com>
parents: 723
diff changeset
1 # -*- coding: utf-8 -*-
547
1e757ac98988 renamed project to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents: 534
diff changeset
2 from rhodecode.tests import *
1e757ac98988 renamed project to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents: 534
diff changeset
3 from rhodecode.model.db import User
1e757ac98988 renamed project to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents: 534
diff changeset
4 from rhodecode.lib.auth import check_password
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
5
188
8337dd6492a9 logins controller test
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
6
8337dd6492a9 logins controller test
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
7 class TestLoginController(TestController):
8337dd6492a9 logins controller test
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
8
8337dd6492a9 logins controller test
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
9 def test_index(self):
8337dd6492a9 logins controller test
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
10 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
11 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
12 # Test response...
461
e95621133eb6 made test for login page
Marcin Kuzminski <marcin@python-works.com>
parents: 188
diff changeset
13
e95621133eb6 made test for login page
Marcin Kuzminski <marcin@python-works.com>
parents: 188
diff changeset
14 def test_login_admin_ok(self):
e95621133eb6 made test for login page
Marcin Kuzminski <marcin@python-works.com>
parents: 188
diff changeset
15 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
16 {'username':'test_admin',
534
12c976209b2e fixed test for new version 100% test are ok
Marcin Kuzminski <marcin@python-works.com>
parents: 533
diff changeset
17 'password':'test12'})
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
18 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
19 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
20 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
21 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
22
461
e95621133eb6 made test for login page
Marcin Kuzminski <marcin@python-works.com>
parents: 188
diff changeset
23 def test_login_regular_ok(self):
e95621133eb6 made test for login page
Marcin Kuzminski <marcin@python-works.com>
parents: 188
diff changeset
24 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
25 {'username':'test_regular',
534
12c976209b2e fixed test for new version 100% test are ok
Marcin Kuzminski <marcin@python-works.com>
parents: 533
diff changeset
26 'password':'test12'})
533
53aa1ee1af86 updated tests for new version 6char password etc...
Marcin Kuzminski <marcin@python-works.com>
parents: 483
diff changeset
27 print response
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
28 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
29 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
30 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
31 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
32 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
33
461
e95621133eb6 made test for login page
Marcin Kuzminski <marcin@python-works.com>
parents: 188
diff changeset
34 def test_login_ok_came_from(self):
e95621133eb6 made test for login page
Marcin Kuzminski <marcin@python-works.com>
parents: 188
diff changeset
35 test_came_from = '/_admin/users'
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
36 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
37 {'username':'test_admin',
534
12c976209b2e fixed test for new version 100% test are ok
Marcin Kuzminski <marcin@python-works.com>
parents: 533
diff changeset
38 'password':'test12'})
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
39 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
40 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
41
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
42 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
43 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
44
758f64f3fbda extended repo creation by repo type. fixed fork creation to maintain repo type.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
45
533
53aa1ee1af86 updated tests for new version 6char password etc...
Marcin Kuzminski <marcin@python-works.com>
parents: 483
diff changeset
46 def test_login_short_password(self):
461
e95621133eb6 made test for login page
Marcin Kuzminski <marcin@python-works.com>
parents: 188
diff changeset
47 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
48 {'username':'error',
e95621133eb6 made test for login page
Marcin Kuzminski <marcin@python-works.com>
parents: 188
diff changeset
49 'password':'test'})
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
50 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
51 print response.body
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 549
diff changeset
52 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
53
53aa1ee1af86 updated tests for new version 6char password etc...
Marcin Kuzminski <marcin@python-works.com>
parents: 483
diff changeset
54 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
55 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
56 {'username':'error',
53aa1ee1af86 updated tests for new version 6char password etc...
Marcin Kuzminski <marcin@python-works.com>
parents: 483
diff changeset
57 'password':'test12'})
53aa1ee1af86 updated tests for new version 6char password etc...
Marcin Kuzminski <marcin@python-works.com>
parents: 483
diff changeset
58 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
59
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
60 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
61 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
62
723
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
63 #==========================================================================
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
64 # REGISTRATIONS
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
65 #==========================================================================
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
66 def test_register(self):
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
67 response = self.app.get(url(controller='login', action='register'))
728
f1629c0c28cc fixed bug in forms found due to testing,
Marcin Kuzminski <marcin@python-works.com>
parents: 723
diff changeset
68 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
69
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
70 def test_register_err_same_username(self):
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
71 response = self.app.post(url(controller='login', action='register'),
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
72 {'username':'test_admin',
723
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
73 'password':'test12',
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
74 'password_confirmation':'test12',
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
75 'email':'goodmail@domain.com',
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
76 'name':'test',
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
77 '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
78
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
79 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
80 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
81
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
82 def test_register_err_wrong_data(self):
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
83 response = self.app.post(url(controller='login', action='register'),
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
84 {'username':'xs',
723
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
85 'password':'test',
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
86 'password_confirmation':'test',
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
87 'email':'goodmailm',
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
88 'name':'test',
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
89 'lastname':'test'})
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
728
f1629c0c28cc fixed bug in forms found due to testing,
Marcin Kuzminski <marcin@python-works.com>
parents: 723
diff changeset
92 assert 'Enter a value 6 characters long or more' 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':'ąćźżąśśśś',
728
f1629c0c28cc fixed bug in forms found due to testing,
Marcin Kuzminski <marcin@python-works.com>
parents: 723
diff changeset
100 'email':'goodmailm@test.plx',
723
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
101 'name':'test',
728
f1629c0c28cc fixed bug in forms found due to testing,
Marcin Kuzminski <marcin@python-works.com>
parents: 723
diff changeset
102 'lastname':'test'})
723
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
103
728
f1629c0c28cc fixed bug in forms found due to testing,
Marcin Kuzminski <marcin@python-works.com>
parents: 723
diff changeset
104 print response.body
723
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
105 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
106 assert 'Invalid characters in password' in response.body
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
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
109 def test_register_password_mismatch(self):
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
110 response = self.app.post(url(controller='login', action='register'),
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
111 {'username':'xs',
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
112 'password':'123qwe',
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
113 'password_confirmation':'qwe123',
728
f1629c0c28cc fixed bug in forms found due to testing,
Marcin Kuzminski <marcin@python-works.com>
parents: 723
diff changeset
114 'email':'goodmailm@test.plxa',
723
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
115 'name':'test',
728
f1629c0c28cc fixed bug in forms found due to testing,
Marcin Kuzminski <marcin@python-works.com>
parents: 723
diff changeset
116 'lastname':'test'})
723
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
117
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
118 assert response.status == '200 OK', 'Wrong response from register page got %s' % response.status
728
f1629c0c28cc fixed bug in forms found due to testing,
Marcin Kuzminski <marcin@python-works.com>
parents: 723
diff changeset
119 print response.body
723
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
120 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
121
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
122 def test_register_ok(self):
473
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 463
diff changeset
123 username = 'test_regular4'
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
124 password = 'qweqwe'
483
a9e50dce3081 Removed config names from whoosh and celery,
Marcin Kuzminski <marcin@python-works.com>
parents: 473
diff changeset
125 email = 'marcin@test.com'
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
126 name = 'testname'
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
127 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
128
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
129 response = self.app.post(url(controller='login', action='register'),
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
130 {'username':username,
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
131 'password':password,
723
bf26b46e82d6 some tests update
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
132 'password_confirmation':password,
463
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
133 'email':email,
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
134 'name':name,
a03250279b15 test for register page
Marcin Kuzminski <marcin@python-works.com>
parents: 462
diff changeset
135 '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
136 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
137 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
138
473
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 463
diff changeset
139 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
140 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
141 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
142 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
143 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
144 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
145
758f64f3fbda extended repo creation by repo type. fixed fork creation to maintain repo type.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
146
758f64f3fbda extended repo creation by repo type. fixed fork creation to maintain repo type.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
147 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
148 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
149 {'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
150
483
a9e50dce3081 Removed config names from whoosh and celery,
Marcin Kuzminski <marcin@python-works.com>
parents: 473
diff changeset
151 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
152
473
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 463
diff changeset
153 def test_forgot_password(self):
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 463
diff changeset
154 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
155 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
156
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 463
diff changeset
157 username = 'test_password_reset_1'
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 463
diff changeset
158 password = 'qweqwe'
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 463
diff changeset
159 email = 'marcin@python-works.com'
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 463
diff changeset
160 name = 'passwd'
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 463
diff changeset
161 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
162
473
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 463
diff changeset
163 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
164 {'username':username,
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 463
diff changeset
165 'password':password,
728
f1629c0c28cc fixed bug in forms found due to testing,
Marcin Kuzminski <marcin@python-works.com>
parents: 723
diff changeset
166 'password_confirmation':password,
473
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 463
diff changeset
167 'email':email,
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 463
diff changeset
168 '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
169 'lastname':lastname})
473
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 463
diff changeset
170 #register new user for email test
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 463
diff changeset
171 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
172 {'email':email, })
473
6b934c9607e7 Improved testing scenarios. Made test env creator
Marcin Kuzminski <marcin@python-works.com>
parents: 463
diff changeset
173 print response.session['flash']
549
f99075170eb4 more renames for rhode code !!
Marcin Kuzminski <marcin@python-works.com>
parents: 548
diff changeset
174 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
175 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
176
758f64f3fbda extended repo creation by repo type. fixed fork creation to maintain repo type.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
177
758f64f3fbda extended repo creation by repo type. fixed fork creation to maintain repo type.
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
178