Show More
@@ -151,7 +151,7 b' class SettingsController(BaseController)' | |||||
151 | def fork_create(self, repo_name): |
|
151 | def fork_create(self, repo_name): | |
152 | repo_model = RepoModel() |
|
152 | repo_model = RepoModel() | |
153 | c.repo_info = repo_model.get(repo_name) |
|
153 | c.repo_info = repo_model.get(repo_name) | |
154 | _form = RepoForkForm()() |
|
154 | _form = RepoForkForm(old_data={'repo_type':c.repo_info.repo_type})() | |
155 | form_result = {} |
|
155 | form_result = {} | |
156 | try: |
|
156 | try: | |
157 | form_result = _form.to_python(dict(request.POST)) |
|
157 | form_result = _form.to_python(dict(request.POST)) |
@@ -11,28 +11,28 b' from rhodecode.lib.utils import get_repo' | |||||
11 | from rhodecode.model import meta |
|
11 | from rhodecode.model import meta | |
12 | from rhodecode.model.hg import _get_repos_cached, \ |
|
12 | from rhodecode.model.hg import _get_repos_cached, \ | |
13 | _get_repos_switcher_cached |
|
13 | _get_repos_switcher_cached | |
14 |
|
14 | from vcs import BACKENDS | ||
15 | class BaseController(WSGIController): |
|
15 | class BaseController(WSGIController): | |
16 |
|
16 | |||
17 | def __before__(self): |
|
17 | def __before__(self): | |
18 | c.rhodecode_version = __version__ |
|
18 | c.rhodecode_version = __version__ | |
19 | c.rhodecode_name = config['rhodecode_title'] |
|
19 | c.rhodecode_name = config['rhodecode_title'] | |
20 | c.repo_name = get_repo_slug(request) |
|
20 | c.repo_name = get_repo_slug(request) | |
21 | c.cached_repo_list = _get_repos_cached() |
|
21 | c.cached_repo_list = _get_repos_cached() | |
22 | c.repo_switcher_list = _get_repos_switcher_cached(c.cached_repo_list) |
|
22 | c.repo_switcher_list = _get_repos_switcher_cached(c.cached_repo_list) | |
23 |
|
23 | c.backends = BACKENDS.keys() | ||
24 | if c.repo_name: |
|
24 | if c.repo_name: | |
25 | cached_repo = c.cached_repo_list.get(c.repo_name) |
|
25 | cached_repo = c.cached_repo_list.get(c.repo_name) | |
26 |
|
26 | |||
27 | if cached_repo: |
|
27 | if cached_repo: | |
28 | c.repository_tags = cached_repo.tags |
|
28 | c.repository_tags = cached_repo.tags | |
29 | c.repository_branches = cached_repo.branches |
|
29 | c.repository_branches = cached_repo.branches | |
30 | else: |
|
30 | else: | |
31 | c.repository_tags = {} |
|
31 | c.repository_tags = {} | |
32 | c.repository_branches = {} |
|
32 | c.repository_branches = {} | |
33 |
|
33 | |||
34 | self.sa = meta.Session() |
|
34 | self.sa = meta.Session() | |
35 |
|
35 | |||
36 | def __call__(self, environ, start_response): |
|
36 | def __call__(self, environ, start_response): | |
37 | """Invoke the Controller""" |
|
37 | """Invoke the Controller""" | |
38 | # WSGIController.__call__ dispatches to the Controller method |
|
38 | # WSGIController.__call__ dispatches to the Controller method |
@@ -289,18 +289,20 b' def send_email(recipients, subject, body' | |||||
289 |
|
289 | |||
290 | @task |
|
290 | @task | |
291 | def create_repo_fork(form_data, cur_user): |
|
291 | def create_repo_fork(form_data, cur_user): | |
292 | import os |
|
|||
293 | from rhodecode.model.repo import RepoModel |
|
292 | from rhodecode.model.repo import RepoModel | |
294 |
|
293 | from vcs import get_backend | ||
|
294 | log = create_repo_fork.get_logger() | |||
295 | repo_model = RepoModel(get_session()) |
|
295 | repo_model = RepoModel(get_session()) | |
296 | repo_model.create(form_data, cur_user, just_db=True, fork=True) |
|
296 | repo_model.create(form_data, cur_user, just_db=True, fork=True) | |
297 |
|
297 | repo_name = form_data['repo_name'] | ||
298 |
repos_path = get_hg_ui_settings()['paths_root_path'] |
|
298 | repos_path = get_hg_ui_settings()['paths_root_path'] | |
299 |
repo_path = os.path.join(repos_path, |
|
299 | repo_path = os.path.join(repos_path, repo_name) | |
300 | repo_fork_path = os.path.join(repos_path, form_data['fork_name']) |
|
300 | repo_fork_path = os.path.join(repos_path, form_data['fork_name']) | |
|
301 | alias = form_data['repo_type'] | |||
301 |
|
302 | |||
302 | MercurialRepository(str(repo_fork_path), True, clone_url=str(repo_path)) |
|
303 | log.info('creating repo fork %s as %s', repo_name, repo_path) | |
303 |
|
304 | backend = get_backend(alias) | ||
|
305 | backend(str(repo_fork_path), create=True, src_url=str(repo_path)) | |||
304 |
|
306 | |||
305 | def __get_codes_stats(repo_name): |
|
307 | def __get_codes_stats(repo_name): | |
306 | LANGUAGES_EXTENSIONS = ['action', 'adp', 'ashx', 'asmx', |
|
308 | LANGUAGES_EXTENSIONS = ['action', 'adp', 'ashx', 'asmx', |
@@ -345,8 +345,9 b' def repo2db_mapper(initial_repo_list, re' | |||||
345 | form_data = { |
|
345 | form_data = { | |
346 | 'repo_name':name, |
|
346 | 'repo_name':name, | |
347 | 'repo_type':repo.alias, |
|
347 | 'repo_type':repo.alias, | |
348 |
'description':repo.description |
|
348 | 'description':repo.description \ | |
349 |
|
|
349 | if repo.description != 'unknown' else \ | |
|
350 | '%s repository' % name, | |||
350 | 'private':False |
|
351 | 'private':False | |
351 | } |
|
352 | } | |
352 | rm.create(form_data, user, just_db=True) |
|
353 | rm.create(form_data, user, just_db=True) |
@@ -30,6 +30,7 b' from rhodecode.model.user import UserMod' | |||||
30 | from rhodecode.model.repo import RepoModel |
|
30 | from rhodecode.model.repo import RepoModel | |
31 | from rhodecode.model.db import User |
|
31 | from rhodecode.model.db import User | |
32 | from webhelpers.pylonslib.secure_form import authentication_token |
|
32 | from webhelpers.pylonslib.secure_form import authentication_token | |
|
33 | from vcs import BACKENDS | |||
33 | import formencode |
|
34 | import formencode | |
34 | import logging |
|
35 | import logging | |
35 | import os |
|
36 | import os | |
@@ -147,6 +148,15 b' def ValidRepoName(edit, old_data):' | |||||
147 |
|
148 | |||
148 | return _ValidRepoName |
|
149 | return _ValidRepoName | |
149 |
|
150 | |||
|
151 | def ValidForkType(old_data): | |||
|
152 | class _ValidForkType(formencode.validators.FancyValidator): | |||
|
153 | ||||
|
154 | def to_python(self, value, state): | |||
|
155 | if old_data['repo_type'] != value: | |||
|
156 | raise formencode.Invalid(_('Fork have to be the same type as original'), value, state) | |||
|
157 | return value | |||
|
158 | return _ValidForkType | |||
|
159 | ||||
150 | class ValidPerms(formencode.validators.FancyValidator): |
|
160 | class ValidPerms(formencode.validators.FancyValidator): | |
151 | messages = {'perm_new_user_name':_('This username is not valid')} |
|
161 | messages = {'perm_new_user_name':_('This username is not valid')} | |
152 |
|
162 | |||
@@ -292,7 +302,7 b' def RepoForm(edit=False, old_data={}):' | |||||
292 | repo_name = All(UnicodeString(strip=True, min=1, not_empty=True), ValidRepoName(edit, old_data)) |
|
302 | repo_name = All(UnicodeString(strip=True, min=1, not_empty=True), ValidRepoName(edit, old_data)) | |
293 | description = UnicodeString(strip=True, min=1, not_empty=True) |
|
303 | description = UnicodeString(strip=True, min=1, not_empty=True) | |
294 | private = StringBoolean(if_missing=False) |
|
304 | private = StringBoolean(if_missing=False) | |
295 |
|
305 | repo_type = OneOf(BACKENDS.keys()) | ||
296 | if edit: |
|
306 | if edit: | |
297 | user = All(Int(not_empty=True), ValidRepoUser) |
|
307 | user = All(Int(not_empty=True), ValidRepoUser) | |
298 |
|
308 | |||
@@ -306,7 +316,7 b' def RepoForkForm(edit=False, old_data={}' | |||||
306 | fork_name = All(UnicodeString(strip=True, min=1, not_empty=True), ValidRepoName(edit, old_data)) |
|
316 | fork_name = All(UnicodeString(strip=True, min=1, not_empty=True), ValidRepoName(edit, old_data)) | |
307 | description = UnicodeString(strip=True, min=1, not_empty=True) |
|
317 | description = UnicodeString(strip=True, min=1, not_empty=True) | |
308 | private = StringBoolean(if_missing=False) |
|
318 | private = StringBoolean(if_missing=False) | |
309 |
|
319 | repo_type = All(ValidForkType(old_data), OneOf(BACKENDS.keys())) | ||
310 | return _RepoForkForm |
|
320 | return _RepoForkForm | |
311 |
|
321 | |||
312 | def RepoSettingsForm(edit=False, old_data={}): |
|
322 | def RepoSettingsForm(edit=False, old_data={}): |
@@ -21,7 +21,7 b' Created on Jun 5, 2010' | |||||
21 | model for handling repositories actions |
|
21 | model for handling repositories actions | |
22 | :author: marcink |
|
22 | :author: marcink | |
23 | """ |
|
23 | """ | |
24 |
|
24 | from vcs.backends import get_repo, get_backend | ||
25 | from datetime import datetime |
|
25 | from datetime import datetime | |
26 | from pylons import app_globals as g |
|
26 | from pylons import app_globals as g | |
27 | from rhodecode.model.db import Repository, RepoToPerm, User, Permission |
|
27 | from rhodecode.model.db import Repository, RepoToPerm, User, Permission | |
@@ -151,7 +151,7 b' class RepoModel(object):' | |||||
151 | self.sa.add(repo_to_perm) |
|
151 | self.sa.add(repo_to_perm) | |
152 | self.sa.commit() |
|
152 | self.sa.commit() | |
153 | if not just_db: |
|
153 | if not just_db: | |
154 | self.__create_repo(repo_name) |
|
154 | self.__create_repo(repo_name, form_data['repo_type']) | |
155 | except: |
|
155 | except: | |
156 | log.error(traceback.format_exc()) |
|
156 | log.error(traceback.format_exc()) | |
157 | self.sa.rollback() |
|
157 | self.sa.rollback() | |
@@ -182,13 +182,13 b' class RepoModel(object):' | |||||
182 | self.sa.rollback() |
|
182 | self.sa.rollback() | |
183 | raise |
|
183 | raise | |
184 |
|
184 | |||
185 | def __create_repo(self, repo_name): |
|
185 | def __create_repo(self, repo_name, alias): | |
186 | from rhodecode.lib.utils import check_repo |
|
186 | from rhodecode.lib.utils import check_repo | |
187 | repo_path = os.path.join(g.base_path, repo_name) |
|
187 | repo_path = os.path.join(g.base_path, repo_name) | |
188 | if check_repo(repo_name, g.base_path): |
|
188 | if check_repo(repo_name, g.base_path): | |
189 | log.info('creating repo %s in %s', repo_name, repo_path) |
|
189 | log.info('creating repo %s in %s', repo_name, repo_path) | |
190 | from vcs.backends.hg import MercurialRepository |
|
190 | backend = get_backend(alias) | |
191 |
|
|
191 | backend(repo_path, create=True) | |
192 |
|
192 | |||
193 | def __rename_repo(self, old, new): |
|
193 | def __rename_repo(self, old, new): | |
194 | log.info('renaming repo from %s to %s', old, new) |
|
194 | log.info('renaming repo from %s to %s', old, new) |
@@ -35,6 +35,14 b'' | |||||
35 | </div> |
|
35 | </div> | |
36 | </div> |
|
36 | </div> | |
37 | <div class="field"> |
|
37 | <div class="field"> | |
|
38 | <div class="label"> | |||
|
39 | <label for="repo_type">${_('Type')}:</label> | |||
|
40 | </div> | |||
|
41 | <div class="input"> | |||
|
42 | ${h.select('repo_type','hg',c.backends,class_="small")} | |||
|
43 | </div> | |||
|
44 | </div> | |||
|
45 | <div class="field"> | |||
38 | <div class="label label-textarea"> |
|
46 | <div class="label label-textarea"> | |
39 | <label for="description">${_('Description')}:</label> |
|
47 | <label for="description">${_('Description')}:</label> | |
40 | </div> |
|
48 | </div> |
@@ -32,6 +32,14 b'' | |||||
32 | </div> |
|
32 | </div> | |
33 | </div> |
|
33 | </div> | |
34 | <div class="field"> |
|
34 | <div class="field"> | |
|
35 | <div class="label"> | |||
|
36 | <label for="repo_type">${_('Type')}:</label> | |||
|
37 | </div> | |||
|
38 | <div class="input"> | |||
|
39 | ${h.select('repo_type','hg',c.backends,class_="small")} | |||
|
40 | </div> | |||
|
41 | </div> | |||
|
42 | <div class="field"> | |||
35 | <div class="label label-textarea"> |
|
43 | <div class="label label-textarea"> | |
36 | <label for="description">${_('Description')}:</label> |
|
44 | <label for="description">${_('Description')}:</label> | |
37 | </div> |
|
45 | </div> |
@@ -35,7 +35,14 b'' | |||||
35 | ${h.text('repo_name',class_="small")} |
|
35 | ${h.text('repo_name',class_="small")} | |
36 | </div> |
|
36 | </div> | |
37 | </div> |
|
37 | </div> | |
38 |
|
38 | <div class="field"> | ||
|
39 | <div class="label"> | |||
|
40 | <label for="repo_type">${_('Type')}:</label> | |||
|
41 | </div> | |||
|
42 | <div class="input"> | |||
|
43 | ${h.select('repo_type','hg',c.backends,class_="small")} | |||
|
44 | </div> | |||
|
45 | </div> | |||
39 | <div class="field"> |
|
46 | <div class="field"> | |
40 | <div class="label label-textarea"> |
|
47 | <div class="label label-textarea"> | |
41 | <label for="description">${_('Description')}:</label> |
|
48 | <label for="description">${_('Description')}:</label> |
@@ -30,6 +30,7 b'' | |||||
30 | </div> |
|
30 | </div> | |
31 | <div class="input"> |
|
31 | <div class="input"> | |
32 | ${h.text('fork_name',class_="small")} |
|
32 | ${h.text('fork_name',class_="small")} | |
|
33 | ${h.hidden('repo_type',c.repo_info.repo_type)} | |||
33 | </div> |
|
34 | </div> | |
34 | </div> |
|
35 | </div> | |
35 | <div class="field"> |
|
36 | <div class="field"> |
@@ -17,8 +17,8 b' class TestLoginController(TestController' | |||||
17 | assert response.status == '302 Found', 'Wrong response code from login got %s' % response.status |
|
17 | assert response.status == '302 Found', 'Wrong response code from login got %s' % response.status | |
18 | assert response.session['rhodecode_user'].username == 'test_admin', 'wrong logged in user' |
|
18 | assert response.session['rhodecode_user'].username == 'test_admin', 'wrong logged in user' | |
19 | response = response.follow() |
|
19 | response = response.follow() | |
20 |
assert ' |
|
20 | assert 'vcs_test repository' in response.body | |
21 |
|
21 | |||
22 | def test_login_regular_ok(self): |
|
22 | def test_login_regular_ok(self): | |
23 | response = self.app.post(url(controller='login', action='index'), |
|
23 | response = self.app.post(url(controller='login', action='index'), | |
24 | {'username':'test_regular', |
|
24 | {'username':'test_regular', | |
@@ -27,9 +27,9 b' class TestLoginController(TestController' | |||||
27 | assert response.status == '302 Found', 'Wrong response code from login got %s' % response.status |
|
27 | assert response.status == '302 Found', 'Wrong response code from login got %s' % response.status | |
28 | assert response.session['rhodecode_user'].username == 'test_regular', 'wrong logged in user' |
|
28 | assert response.session['rhodecode_user'].username == 'test_regular', 'wrong logged in user' | |
29 | response = response.follow() |
|
29 | response = response.follow() | |
30 |
assert ' |
|
30 | assert 'vcs_test repository' in response.body | |
31 | assert '<a title="Admin" href="/_admin">' not in response.body |
|
31 | assert '<a title="Admin" href="/_admin">' not in response.body | |
32 |
|
32 | |||
33 | def test_login_ok_came_from(self): |
|
33 | def test_login_ok_came_from(self): | |
34 | test_came_from = '/_admin/users' |
|
34 | test_came_from = '/_admin/users' | |
35 | response = self.app.post(url(controller='login', action='index', came_from=test_came_from), |
|
35 | response = self.app.post(url(controller='login', action='index', came_from=test_came_from), | |
@@ -37,11 +37,11 b' class TestLoginController(TestController' | |||||
37 | 'password':'test12'}) |
|
37 | 'password':'test12'}) | |
38 | assert response.status == '302 Found', 'Wrong response code from came from redirection' |
|
38 | assert response.status == '302 Found', 'Wrong response code from came from redirection' | |
39 | response = response.follow() |
|
39 | response = response.follow() | |
40 |
|
40 | |||
41 | assert response.status == '200 OK', 'Wrong response from login page got %s' % response.status |
|
41 | assert response.status == '200 OK', 'Wrong response from login page got %s' % response.status | |
42 | assert 'Users administration' in response.body, 'No proper title in response' |
|
42 | assert 'Users administration' in response.body, 'No proper title in response' | |
43 |
|
43 | |||
44 |
|
44 | |||
45 | def test_login_short_password(self): |
|
45 | def test_login_short_password(self): | |
46 | response = self.app.post(url(controller='login', action='index'), |
|
46 | response = self.app.post(url(controller='login', action='index'), | |
47 | {'username':'error', |
|
47 | {'username':'error', | |
@@ -55,15 +55,15 b' class TestLoginController(TestController' | |||||
55 | {'username':'error', |
|
55 | {'username':'error', | |
56 | 'password':'test12'}) |
|
56 | 'password':'test12'}) | |
57 | assert response.status == '200 OK', 'Wrong response from login page' |
|
57 | assert response.status == '200 OK', 'Wrong response from login page' | |
58 |
|
58 | |||
59 | assert 'invalid user name' in response.body, 'No error username message in response' |
|
59 | assert 'invalid user name' in response.body, 'No error username message in response' | |
60 | assert 'invalid password' in response.body, 'No error password message in response' |
|
60 | assert 'invalid password' in response.body, 'No error password message in response' | |
61 |
|
61 | |||
62 |
|
62 | |||
63 | def test_register(self): |
|
63 | def test_register(self): | |
64 | response = self.app.get(url(controller='login', action='register')) |
|
64 | response = self.app.get(url(controller='login', action='register')) | |
65 | assert 'Sign Up to rhodecode' in response.body, 'wrong page for user registration' |
|
65 | assert 'Sign Up to rhodecode' in response.body, 'wrong page for user registration' | |
66 |
|
66 | |||
67 | def test_register_err_same_username(self): |
|
67 | def test_register_err_same_username(self): | |
68 | response = self.app.post(url(controller='login', action='register'), |
|
68 | response = self.app.post(url(controller='login', action='register'), | |
69 | {'username':'test_admin', |
|
69 | {'username':'test_admin', | |
@@ -71,10 +71,10 b' class TestLoginController(TestController' | |||||
71 | 'email':'goodmail@domain.com', |
|
71 | 'email':'goodmail@domain.com', | |
72 | 'name':'test', |
|
72 | 'name':'test', | |
73 | 'lastname':'test'}) |
|
73 | 'lastname':'test'}) | |
74 |
|
74 | |||
75 | assert response.status == '200 OK', 'Wrong response from register page got %s' % response.status |
|
75 | assert response.status == '200 OK', 'Wrong response from register page got %s' % response.status | |
76 |
assert 'This username already exists' in response.body |
|
76 | assert 'This username already exists' in response.body | |
77 |
|
77 | |||
78 | def test_register_err_wrong_data(self): |
|
78 | def test_register_err_wrong_data(self): | |
79 | response = self.app.post(url(controller='login', action='register'), |
|
79 | response = self.app.post(url(controller='login', action='register'), | |
80 | {'username':'xs', |
|
80 | {'username':'xs', | |
@@ -82,20 +82,20 b' class TestLoginController(TestController' | |||||
82 | 'email':'goodmailm', |
|
82 | 'email':'goodmailm', | |
83 | 'name':'test', |
|
83 | 'name':'test', | |
84 | 'lastname':'test'}) |
|
84 | 'lastname':'test'}) | |
85 |
|
85 | |||
86 | assert response.status == '200 OK', 'Wrong response from register page got %s' % response.status |
|
86 | assert response.status == '200 OK', 'Wrong response from register page got %s' % response.status | |
87 | assert 'An email address must contain a single @' in response.body |
|
87 | assert 'An email address must contain a single @' in response.body | |
88 | assert 'Please enter a value' in response.body |
|
88 | assert 'Please enter a value' in response.body | |
89 |
|
89 | |||
90 |
|
90 | |||
91 |
|
91 | |||
92 | def test_register_ok(self): |
|
92 | def test_register_ok(self): | |
93 | username = 'test_regular4' |
|
93 | username = 'test_regular4' | |
94 | password = 'qweqwe' |
|
94 | password = 'qweqwe' | |
95 | email = 'marcin@test.com' |
|
95 | email = 'marcin@test.com' | |
96 | name = 'testname' |
|
96 | name = 'testname' | |
97 | lastname = 'testlastname' |
|
97 | lastname = 'testlastname' | |
98 |
|
98 | |||
99 | response = self.app.post(url(controller='login', action='register'), |
|
99 | response = self.app.post(url(controller='login', action='register'), | |
100 | {'username':username, |
|
100 | {'username':username, | |
101 | 'password':password, |
|
101 | 'password':password, | |
@@ -103,23 +103,23 b' class TestLoginController(TestController' | |||||
103 | 'name':name, |
|
103 | 'name':name, | |
104 | 'lastname':lastname}) |
|
104 | 'lastname':lastname}) | |
105 | print response.body |
|
105 | print response.body | |
106 |
assert response.status == '302 Found', 'Wrong response from register page got %s' % response.status |
|
106 | assert response.status == '302 Found', 'Wrong response from register page got %s' % response.status | |
107 | assert 'You have successfully registered into rhodecode' in response.session['flash'][0], 'No flash message about user registration' |
|
107 | assert 'You have successfully registered into rhodecode' in response.session['flash'][0], 'No flash message about user registration' | |
108 |
|
108 | |||
109 | ret = self.sa.query(User).filter(User.username == 'test_regular4').one() |
|
109 | ret = self.sa.query(User).filter(User.username == 'test_regular4').one() | |
110 | assert ret.username == username , 'field mismatch %s %s' % (ret.username, username) |
|
110 | assert ret.username == username , 'field mismatch %s %s' % (ret.username, username) | |
111 | assert check_password(password, ret.password) == True , 'password mismatch' |
|
111 | assert check_password(password, ret.password) == True , 'password mismatch' | |
112 | assert ret.email == email , 'field mismatch %s %s' % (ret.email, email) |
|
112 | assert ret.email == email , 'field mismatch %s %s' % (ret.email, email) | |
113 | assert ret.name == name , 'field mismatch %s %s' % (ret.name, name) |
|
113 | assert ret.name == name , 'field mismatch %s %s' % (ret.name, name) | |
114 | assert ret.lastname == lastname , 'field mismatch %s %s' % (ret.lastname, lastname) |
|
114 | assert ret.lastname == lastname , 'field mismatch %s %s' % (ret.lastname, lastname) | |
115 |
|
115 | |||
116 |
|
116 | |||
117 |
def test_forgot_password_wrong_mail(self): |
|
117 | def test_forgot_password_wrong_mail(self): | |
118 | response = self.app.post(url(controller='login', action='password_reset'), |
|
118 | response = self.app.post(url(controller='login', action='password_reset'), | |
119 | {'email':'marcin@wrongmail.org', }) |
|
119 | {'email':'marcin@wrongmail.org', }) | |
120 |
|
120 | |||
121 | assert "That e-mail address doesn't exist" in response.body, 'Missing error message about wrong email' |
|
121 | assert "That e-mail address doesn't exist" in response.body, 'Missing error message about wrong email' | |
122 |
|
122 | |||
123 | def test_forgot_password(self): |
|
123 | def test_forgot_password(self): | |
124 | response = self.app.get(url(controller='login', action='password_reset')) |
|
124 | response = self.app.get(url(controller='login', action='password_reset')) | |
125 | assert response.status == '200 OK', 'Wrong response from login page got %s' % response.status |
|
125 | assert response.status == '200 OK', 'Wrong response from login page got %s' % response.status | |
@@ -129,19 +129,19 b' class TestLoginController(TestController' | |||||
129 | email = 'marcin@python-works.com' |
|
129 | email = 'marcin@python-works.com' | |
130 | name = 'passwd' |
|
130 | name = 'passwd' | |
131 | lastname = 'reset' |
|
131 | lastname = 'reset' | |
132 |
|
132 | |||
133 | response = self.app.post(url(controller='login', action='register'), |
|
133 | response = self.app.post(url(controller='login', action='register'), | |
134 | {'username':username, |
|
134 | {'username':username, | |
135 | 'password':password, |
|
135 | 'password':password, | |
136 | 'email':email, |
|
136 | 'email':email, | |
137 | 'name':name, |
|
137 | 'name':name, | |
138 |
'lastname':lastname}) |
|
138 | 'lastname':lastname}) | |
139 | #register new user for email test |
|
139 | #register new user for email test | |
140 | response = self.app.post(url(controller='login', action='password_reset'), |
|
140 | response = self.app.post(url(controller='login', action='password_reset'), | |
141 | {'email':email, }) |
|
141 | {'email':email, }) | |
142 | print response.session['flash'] |
|
142 | print response.session['flash'] | |
143 | assert 'You have successfully registered into rhodecode' in response.session['flash'][0], 'No flash message about user registration' |
|
143 | assert 'You have successfully registered into rhodecode' in response.session['flash'][0], 'No flash message about user registration' | |
144 | assert 'Your new password was sent' in response.session['flash'][1], 'No flash message about password reset' |
|
144 | assert 'Your new password was sent' in response.session['flash'][1], 'No flash message about password reset' | |
145 |
|
145 | |||
146 |
|
146 | |||
147 |
|
147 |
General Comments 0
You need to be logged in to leave comments.
Login now