Mercurial > kallithea
annotate rhodecode/tests/functional/test_admin_settings.py @ 893:ead7be02283b beta
updated tests for application settings
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Wed, 29 Dec 2010 12:19:08 +0100 |
parents | 51127b2efb33 |
children | c0335c1dee36 |
rev | line source |
---|---|
754
101a407827e8
fixed test that broke admin email address
Marcin Kuzminski <marcin@python-works.com>
parents:
746
diff
changeset
|
1 from rhodecode.lib.auth import get_crypt_password, check_password |
101a407827e8
fixed test that broke admin email address
Marcin Kuzminski <marcin@python-works.com>
parents:
746
diff
changeset
|
2 from rhodecode.model.db import User |
547
1e757ac98988
renamed project to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents:
534
diff
changeset
|
3 from rhodecode.tests import * |
893
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
4 from rhodecode.model.settings import SettingsModel |
346
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
5 |
691
7486da5f0628
Refactor codes for scm model
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
6 class TestAdminSettingsController(TestController): |
346
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
7 |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
8 def test_index(self): |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
9 response = self.app.get(url('admin_settings')) |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
10 # Test response... |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
11 |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
12 def test_index_as_xml(self): |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
13 response = self.app.get(url('formatted_admin_settings', format='xml')) |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
14 |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
15 def test_create(self): |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
16 response = self.app.post(url('admin_settings')) |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
17 |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
18 def test_new(self): |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
19 response = self.app.get(url('admin_new_setting')) |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
20 |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
21 def test_new_as_xml(self): |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
22 response = self.app.get(url('formatted_admin_new_setting', format='xml')) |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
23 |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
24 def test_update(self): |
459
7c978511c951
implemented basic (startup) nose test suite.
Marcin Kuzminski <marcin@python-works.com>
parents:
346
diff
changeset
|
25 response = self.app.put(url('admin_setting', setting_id=1)) |
346
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
26 |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
27 def test_update_browser_fakeout(self): |
459
7c978511c951
implemented basic (startup) nose test suite.
Marcin Kuzminski <marcin@python-works.com>
parents:
346
diff
changeset
|
28 response = self.app.post(url('admin_setting', setting_id=1), params=dict(_method='put')) |
346
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
29 |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
30 def test_delete(self): |
459
7c978511c951
implemented basic (startup) nose test suite.
Marcin Kuzminski <marcin@python-works.com>
parents:
346
diff
changeset
|
31 response = self.app.delete(url('admin_setting', setting_id=1)) |
346
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
32 |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
33 def test_delete_browser_fakeout(self): |
459
7c978511c951
implemented basic (startup) nose test suite.
Marcin Kuzminski <marcin@python-works.com>
parents:
346
diff
changeset
|
34 response = self.app.post(url('admin_setting', setting_id=1), params=dict(_method='delete')) |
346
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
35 |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
36 def test_show(self): |
459
7c978511c951
implemented basic (startup) nose test suite.
Marcin Kuzminski <marcin@python-works.com>
parents:
346
diff
changeset
|
37 response = self.app.get(url('admin_setting', setting_id=1)) |
346
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
38 |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
39 def test_show_as_xml(self): |
459
7c978511c951
implemented basic (startup) nose test suite.
Marcin Kuzminski <marcin@python-works.com>
parents:
346
diff
changeset
|
40 response = self.app.get(url('formatted_admin_setting', setting_id=1, format='xml')) |
346
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
41 |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
42 def test_edit(self): |
459
7c978511c951
implemented basic (startup) nose test suite.
Marcin Kuzminski <marcin@python-works.com>
parents:
346
diff
changeset
|
43 response = self.app.get(url('admin_edit_setting', setting_id=1)) |
346
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
44 |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
45 def test_edit_as_xml(self): |
459
7c978511c951
implemented basic (startup) nose test suite.
Marcin Kuzminski <marcin@python-works.com>
parents:
346
diff
changeset
|
46 response = self.app.get(url('formatted_admin_edit_setting', setting_id=1, format='xml')) |
491
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
47 |
893
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
48 |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
49 def test_ga_code_active(self): |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
50 self.log_user() |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
51 old_title = 'RhodeCode' |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
52 old_realm = 'RhodeCode authentication' |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
53 new_ga_code = 'ga-test-123456789' |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
54 response = self.app.post(url('admin_setting', setting_id='global'), |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
55 params=dict( |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
56 _method='put', |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
57 rhodecode_title=old_title, |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
58 rhodecode_realm=old_realm, |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
59 rhodecode_ga_code=new_ga_code |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
60 )) |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
61 |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
62 assert 'Updated application settings' in response.session['flash'][0][1], 'no flash message about success of change' |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
63 assert SettingsModel(self.sa).get_app_settings()['rhodecode_ga_code'] == new_ga_code, 'change not in database' |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
64 |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
65 response = response.follow() |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
66 assert """_gaq.push(['_setAccount', '%s']);""" % new_ga_code in response.body |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
67 |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
68 def test_ga_code_inactive(self): |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
69 self.log_user() |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
70 old_title = 'RhodeCode' |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
71 old_realm = 'RhodeCode authentication' |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
72 new_ga_code = '' |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
73 response = self.app.post(url('admin_setting', setting_id='global'), |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
74 params=dict( |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
75 _method='put', |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
76 rhodecode_title=old_title, |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
77 rhodecode_realm=old_realm, |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
78 rhodecode_ga_code=new_ga_code |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
79 )) |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
80 |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
81 assert 'Updated application settings' in response.session['flash'][0][1], 'no flash message about success of change' |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
82 assert SettingsModel(self.sa).get_app_settings()['rhodecode_ga_code'] == new_ga_code, 'change not in database' |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
83 |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
84 response = response.follow() |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
85 assert """_gaq.push(['_setAccount', '%s']);""" % new_ga_code not in response.body |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
86 |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
87 |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
88 def test_title_change(self): |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
89 self.log_user() |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
90 old_title = 'RhodeCode' |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
91 new_title = old_title + '_changed' |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
92 old_realm = 'RhodeCode authentication' |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
93 response = self.app.post(url('admin_setting', setting_id='global'), |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
94 params=dict( |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
95 _method='put', |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
96 rhodecode_title=new_title, |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
97 rhodecode_realm=old_realm, |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
98 rhodecode_ga_code='' |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
99 )) |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
100 |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
101 |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
102 assert 'Updated application settings' in response.session['flash'][0][1], 'no flash message about success of change' |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
103 assert SettingsModel(self.sa).get_app_settings()['rhodecode_title'] == new_title, 'change not in database' |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
104 |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
105 response = response.follow() |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
106 assert """<h1><a href="/">%s</a></h1>""" % new_title in response.body |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
107 |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
108 |
491
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
109 def test_my_account(self): |
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
110 self.log_user() |
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
111 response = self.app.get(url('admin_settings_my_account')) |
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
112 print response |
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
113 assert 'value="test_admin' in response.body |
691
7486da5f0628
Refactor codes for scm model
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
114 |
491
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
115 def test_my_account_update(self): |
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
116 self.log_user() |
754
101a407827e8
fixed test that broke admin email address
Marcin Kuzminski <marcin@python-works.com>
parents:
746
diff
changeset
|
117 |
491
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
118 new_email = 'new@mail.pl' |
754
101a407827e8
fixed test that broke admin email address
Marcin Kuzminski <marcin@python-works.com>
parents:
746
diff
changeset
|
119 new_name = 'NewName' |
101a407827e8
fixed test that broke admin email address
Marcin Kuzminski <marcin@python-works.com>
parents:
746
diff
changeset
|
120 new_lastname = 'NewLastname' |
101a407827e8
fixed test that broke admin email address
Marcin Kuzminski <marcin@python-works.com>
parents:
746
diff
changeset
|
121 new_password = 'test123' |
101a407827e8
fixed test that broke admin email address
Marcin Kuzminski <marcin@python-works.com>
parents:
746
diff
changeset
|
122 |
101a407827e8
fixed test that broke admin email address
Marcin Kuzminski <marcin@python-works.com>
parents:
746
diff
changeset
|
123 |
491
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
124 response = self.app.post(url('admin_settings_my_account_update'), params=dict( |
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
125 _method='put', |
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
126 username='test_admin', |
754
101a407827e8
fixed test that broke admin email address
Marcin Kuzminski <marcin@python-works.com>
parents:
746
diff
changeset
|
127 new_password=new_password, |
491
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
128 password='', |
754
101a407827e8
fixed test that broke admin email address
Marcin Kuzminski <marcin@python-works.com>
parents:
746
diff
changeset
|
129 name=new_name, |
101a407827e8
fixed test that broke admin email address
Marcin Kuzminski <marcin@python-works.com>
parents:
746
diff
changeset
|
130 lastname=new_lastname, |
491
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
131 email=new_email,)) |
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
132 response.follow() |
691
7486da5f0628
Refactor codes for scm model
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
133 |
782
51127b2efb33
fixed broken test after latest changes
Marcin Kuzminski <marcin@python-works.com>
parents:
754
diff
changeset
|
134 assert 'Your account was updated successfully' in response.session['flash'][0][1], 'no flash message about success of change' |
491
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
135 user = self.sa.query(User).filter(User.username == 'test_admin').one() |
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
136 assert user.email == new_email , 'incorrect user email after update got %s vs %s' % (user.email, new_email) |
754
101a407827e8
fixed test that broke admin email address
Marcin Kuzminski <marcin@python-works.com>
parents:
746
diff
changeset
|
137 assert user.name == new_name, 'updated field mismatch %s vs %s' % (user.name, new_name) |
101a407827e8
fixed test that broke admin email address
Marcin Kuzminski <marcin@python-works.com>
parents:
746
diff
changeset
|
138 assert user.lastname == new_lastname, 'updated field mismatch %s vs %s' % (user.lastname, new_lastname) |
101a407827e8
fixed test that broke admin email address
Marcin Kuzminski <marcin@python-works.com>
parents:
746
diff
changeset
|
139 assert check_password(new_password, user.password) is True, 'password field mismatch %s vs %s' % (user.password, new_password) |
691
7486da5f0628
Refactor codes for scm model
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
140 |
754
101a407827e8
fixed test that broke admin email address
Marcin Kuzminski <marcin@python-works.com>
parents:
746
diff
changeset
|
141 #bring back the admin settings |
101a407827e8
fixed test that broke admin email address
Marcin Kuzminski <marcin@python-works.com>
parents:
746
diff
changeset
|
142 old_email = 'test_admin@mail.com' |
101a407827e8
fixed test that broke admin email address
Marcin Kuzminski <marcin@python-works.com>
parents:
746
diff
changeset
|
143 old_name = 'RhodeCode' |
101a407827e8
fixed test that broke admin email address
Marcin Kuzminski <marcin@python-works.com>
parents:
746
diff
changeset
|
144 old_lastname = 'Admin' |
101a407827e8
fixed test that broke admin email address
Marcin Kuzminski <marcin@python-works.com>
parents:
746
diff
changeset
|
145 old_password = 'test12' |
691
7486da5f0628
Refactor codes for scm model
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
146 |
491
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
147 response = self.app.post(url('admin_settings_my_account_update'), params=dict( |
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
148 _method='put', |
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
149 username='test_admin', |
754
101a407827e8
fixed test that broke admin email address
Marcin Kuzminski <marcin@python-works.com>
parents:
746
diff
changeset
|
150 new_password=old_password, |
101a407827e8
fixed test that broke admin email address
Marcin Kuzminski <marcin@python-works.com>
parents:
746
diff
changeset
|
151 password='', |
101a407827e8
fixed test that broke admin email address
Marcin Kuzminski <marcin@python-works.com>
parents:
746
diff
changeset
|
152 name=old_name, |
101a407827e8
fixed test that broke admin email address
Marcin Kuzminski <marcin@python-works.com>
parents:
746
diff
changeset
|
153 lastname=old_lastname, |
101a407827e8
fixed test that broke admin email address
Marcin Kuzminski <marcin@python-works.com>
parents:
746
diff
changeset
|
154 email=old_email,)) |
101a407827e8
fixed test that broke admin email address
Marcin Kuzminski <marcin@python-works.com>
parents:
746
diff
changeset
|
155 |
101a407827e8
fixed test that broke admin email address
Marcin Kuzminski <marcin@python-works.com>
parents:
746
diff
changeset
|
156 response.follow() |
782
51127b2efb33
fixed broken test after latest changes
Marcin Kuzminski <marcin@python-works.com>
parents:
754
diff
changeset
|
157 assert 'Your account was updated successfully' in response.session['flash'][0][1], 'no flash message about success of change' |
754
101a407827e8
fixed test that broke admin email address
Marcin Kuzminski <marcin@python-works.com>
parents:
746
diff
changeset
|
158 user = self.sa.query(User).filter(User.username == 'test_admin').one() |
101a407827e8
fixed test that broke admin email address
Marcin Kuzminski <marcin@python-works.com>
parents:
746
diff
changeset
|
159 assert user.email == old_email , 'incorrect user email after update got %s vs %s' % (user.email, old_email) |
101a407827e8
fixed test that broke admin email address
Marcin Kuzminski <marcin@python-works.com>
parents:
746
diff
changeset
|
160 |
101a407827e8
fixed test that broke admin email address
Marcin Kuzminski <marcin@python-works.com>
parents:
746
diff
changeset
|
161 assert user.email == old_email , 'incorrect user email after update got %s vs %s' % (user.email, old_email) |
101a407827e8
fixed test that broke admin email address
Marcin Kuzminski <marcin@python-works.com>
parents:
746
diff
changeset
|
162 assert user.name == old_name, 'updated field mismatch %s vs %s' % (user.name, old_name) |
101a407827e8
fixed test that broke admin email address
Marcin Kuzminski <marcin@python-works.com>
parents:
746
diff
changeset
|
163 assert user.lastname == old_lastname, 'updated field mismatch %s vs %s' % (user.lastname, old_lastname) |
101a407827e8
fixed test that broke admin email address
Marcin Kuzminski <marcin@python-works.com>
parents:
746
diff
changeset
|
164 assert check_password(old_password, user.password) is True , 'password updated field mismatch %s vs %s' % (user.password, old_password) |
101a407827e8
fixed test that broke admin email address
Marcin Kuzminski <marcin@python-works.com>
parents:
746
diff
changeset
|
165 |
691
7486da5f0628
Refactor codes for scm model
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
166 |
491
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
167 def test_my_account_update_err_email_exists(self): |
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
168 self.log_user() |
691
7486da5f0628
Refactor codes for scm model
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
169 |
491
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
170 new_email = 'test_regular@mail.com'#already exisitn email |
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
171 response = self.app.post(url('admin_settings_my_account_update'), params=dict( |
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
172 _method='put', |
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
173 username='test_admin', |
533
53aa1ee1af86
updated tests for new version 6char password etc...
Marcin Kuzminski <marcin@python-works.com>
parents:
491
diff
changeset
|
174 new_password='test12', |
491
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
175 name='NewName', |
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
176 lastname='NewLastname', |
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
177 email=new_email,)) |
691
7486da5f0628
Refactor codes for scm model
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
178 |
746
18a3ca35d501
fixed grammar in taken email error
Marcin Kuzminski <marcin@python-works.com>
parents:
691
diff
changeset
|
179 assert 'This e-mail address is already taken' in response.body, 'Missing error message about existing email' |
691
7486da5f0628
Refactor codes for scm model
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
180 |
7486da5f0628
Refactor codes for scm model
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
181 |
491
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
182 def test_my_account_update_err(self): |
533
53aa1ee1af86
updated tests for new version 6char password etc...
Marcin Kuzminski <marcin@python-works.com>
parents:
491
diff
changeset
|
183 self.log_user('test_regular2', 'test12') |
691
7486da5f0628
Refactor codes for scm model
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
184 |
491
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
185 new_email = 'newmail.pl' |
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
186 response = self.app.post(url('admin_settings_my_account_update'), params=dict( |
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
187 _method='put', |
533
53aa1ee1af86
updated tests for new version 6char password etc...
Marcin Kuzminski <marcin@python-works.com>
parents:
491
diff
changeset
|
188 username='test_admin', |
53aa1ee1af86
updated tests for new version 6char password etc...
Marcin Kuzminski <marcin@python-works.com>
parents:
491
diff
changeset
|
189 new_password='test12', |
491
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
190 name='NewName', |
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
191 lastname='NewLastname', |
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
192 email=new_email,)) |
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
193 assert 'An email address must contain a single @' in response.body, 'Missing error message about wrong email' |
fefffd6fd5f4
Added some more tests, rewrite testing schema, to autogenerate fresh db, new index.
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
194 assert 'This username already exists' in response.body, 'Missing error message about existing user' |