Mercurial > kallithea
annotate rhodecode/tests/functional/test_admin_settings.py @ 3484:75e563531350 beta
compare: drop unused rev_start and rev_end
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Mon, 04 Mar 2013 17:38:34 +0100 |
parents | d5e42c00f3c1 |
children | 4f80df0d45c8 |
rev | line source |
---|---|
1366
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1292
diff
changeset
|
1 # -*- coding: utf-8 -*- |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1292
diff
changeset
|
2 |
754
101a407827e8
fixed test that broke admin email address
Marcin Kuzminski <marcin@python-works.com>
parents:
746
diff
changeset
|
3 from rhodecode.lib.auth import get_crypt_password, check_password |
2629
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
4 from rhodecode.model.db import User, RhodeCodeSetting, Repository |
547
1e757ac98988
renamed project to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents:
534
diff
changeset
|
5 from rhodecode.tests import * |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
6 from rhodecode.lib import helpers as h |
2544
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
7 from rhodecode.model.user import UserModel |
2629
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
8 from rhodecode.model.scm import ScmModel |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
9 |
346
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
10 |
691
7486da5f0628
Refactor codes for scm model
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
11 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
|
12 |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
13 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
|
14 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
|
15 # Test response... |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
16 |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
17 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
|
18 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
|
19 |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
20 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
|
21 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
|
22 |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
23 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
|
24 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
|
25 |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
26 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
|
27 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
|
28 |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
29 def test_update(self): |
459
7c978511c951
implemented basic (startup) nose test suite.
Marcin Kuzminski <marcin@python-works.com>
parents:
346
diff
changeset
|
30 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
|
31 |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
32 def test_update_browser_fakeout(self): |
459
7c978511c951
implemented basic (startup) nose test suite.
Marcin Kuzminski <marcin@python-works.com>
parents:
346
diff
changeset
|
33 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
|
34 |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
35 def test_delete(self): |
459
7c978511c951
implemented basic (startup) nose test suite.
Marcin Kuzminski <marcin@python-works.com>
parents:
346
diff
changeset
|
36 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
|
37 |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
38 def test_delete_browser_fakeout(self): |
459
7c978511c951
implemented basic (startup) nose test suite.
Marcin Kuzminski <marcin@python-works.com>
parents:
346
diff
changeset
|
39 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
|
40 |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
41 def test_show(self): |
459
7c978511c951
implemented basic (startup) nose test suite.
Marcin Kuzminski <marcin@python-works.com>
parents:
346
diff
changeset
|
42 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
|
43 |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
44 def test_show_as_xml(self): |
459
7c978511c951
implemented basic (startup) nose test suite.
Marcin Kuzminski <marcin@python-works.com>
parents:
346
diff
changeset
|
45 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
|
46 |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
47 def test_edit(self): |
459
7c978511c951
implemented basic (startup) nose test suite.
Marcin Kuzminski <marcin@python-works.com>
parents:
346
diff
changeset
|
48 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
|
49 |
51362853ac3b
added settings rest controllers for admin, updated routes with easier submodule handling
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
50 def test_edit_as_xml(self): |
1366
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1292
diff
changeset
|
51 response = self.app.get(url('formatted_admin_edit_setting', |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1292
diff
changeset
|
52 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
|
53 |
893
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
54 def test_ga_code_active(self): |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
55 self.log_user() |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
56 old_title = 'RhodeCode' |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
57 old_realm = 'RhodeCode authentication' |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
58 new_ga_code = 'ga-test-123456789' |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
59 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
|
60 params=dict( |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
61 _method='put', |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
62 rhodecode_title=old_title, |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
63 rhodecode_realm=old_realm, |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
64 rhodecode_ga_code=new_ga_code |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
65 )) |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
66 |
1382
c310e1e1e757
Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
67 self.checkSessionFlash(response, 'Updated application settings') |
c310e1e1e757
Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
68 |
1633
2c0d35e336b5
refactoring of models names for repoGroup permissions
Marcin Kuzminski <marcin@python-works.com>
parents:
1597
diff
changeset
|
69 self.assertEqual(RhodeCodeSetting |
1366
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1292
diff
changeset
|
70 .get_app_settings()['rhodecode_ga_code'], new_ga_code) |
893
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
71 |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
72 response = response.follow() |
2544
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
73 response.mustcontain("""_gaq.push(['_setAccount', '%s']);""" % new_ga_code) |
893
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
74 |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
75 def test_ga_code_inactive(self): |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
76 self.log_user() |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
77 old_title = 'RhodeCode' |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
78 old_realm = 'RhodeCode authentication' |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
79 new_ga_code = '' |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
80 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
|
81 params=dict( |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
82 _method='put', |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
83 rhodecode_title=old_title, |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
84 rhodecode_realm=old_realm, |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
85 rhodecode_ga_code=new_ga_code |
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 |
1366
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1292
diff
changeset
|
88 self.assertTrue('Updated application settings' in |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1292
diff
changeset
|
89 response.session['flash'][0][1]) |
1633
2c0d35e336b5
refactoring of models names for repoGroup permissions
Marcin Kuzminski <marcin@python-works.com>
parents:
1597
diff
changeset
|
90 self.assertEqual(RhodeCodeSetting |
1366
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1292
diff
changeset
|
91 .get_app_settings()['rhodecode_ga_code'], new_ga_code) |
893
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
92 |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
93 response = response.follow() |
2544
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
94 self.assertFalse("""_gaq.push(['_setAccount', '%s']);""" % new_ga_code |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
95 in response.body) |
893
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
96 |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
97 def test_title_change(self): |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
98 self.log_user() |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
99 old_title = 'RhodeCode' |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
100 new_title = old_title + '_changed' |
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
101 old_realm = 'RhodeCode authentication' |
1366
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1292
diff
changeset
|
102 |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1292
diff
changeset
|
103 for new_title in ['Changed', 'Żółwik', old_title]: |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1292
diff
changeset
|
104 response = self.app.post(url('admin_setting', setting_id='global'), |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1292
diff
changeset
|
105 params=dict( |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1292
diff
changeset
|
106 _method='put', |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1292
diff
changeset
|
107 rhodecode_title=new_title, |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1292
diff
changeset
|
108 rhodecode_realm=old_realm, |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1292
diff
changeset
|
109 rhodecode_ga_code='' |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1292
diff
changeset
|
110 )) |
893
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
111 |
1382
c310e1e1e757
Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
112 self.checkSessionFlash(response, 'Updated application settings') |
1633
2c0d35e336b5
refactoring of models names for repoGroup permissions
Marcin Kuzminski <marcin@python-works.com>
parents:
1597
diff
changeset
|
113 self.assertEqual(RhodeCodeSetting |
1366
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1292
diff
changeset
|
114 .get_app_settings()['rhodecode_title'], |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1292
diff
changeset
|
115 new_title.decode('utf-8')) |
893
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
116 |
1366
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1292
diff
changeset
|
117 response = response.follow() |
2544
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
118 response.mustcontain("""<h1><a href="/">%s</a></h1>""" % new_title) |
893
ead7be02283b
updated tests for application settings
Marcin Kuzminski <marcin@python-works.com>
parents:
782
diff
changeset
|
119 |
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
|
120 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
|
121 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
|
122 response = self.app.get(url('admin_settings_my_account')) |
1366
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1292
diff
changeset
|
123 |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1292
diff
changeset
|
124 self.assertTrue('value="test_admin' in response.body) |
691
7486da5f0628
Refactor codes for scm model
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
125 |
2544
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
126 @parameterized.expand([('firstname', 'new_username'), |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
127 ('lastname', 'new_username'), |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
128 ('admin', True), |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
129 ('admin', False), |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
130 ('ldap_dn', 'test'), |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
131 ('ldap_dn', None), |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
132 ('active', False), |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
133 ('active', True), |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
134 ('email', 'some@email.com'), |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
135 ]) |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
136 def test_my_account_update(self, name, expected): |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
137 uname = 'testme' |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
138 usr = UserModel().create_or_update(username=uname, password='qweqwe', |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
139 email='testme@rhodecod.org') |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
140 self.Session().commit() |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
141 params = usr.get_api_data() |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
142 user_id = usr.user_id |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
143 self.log_user(username=uname, password='qweqwe') |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
144 params.update({name: expected}) |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
145 params.update({'password_confirmation': ''}) |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
146 params.update({'new_password': ''}) |
754
101a407827e8
fixed test that broke admin email address
Marcin Kuzminski <marcin@python-works.com>
parents:
746
diff
changeset
|
147 |
2544
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
148 try: |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
149 response = self.app.put(url('admin_settings_my_account_update', |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
150 id=user_id), params) |
691
7486da5f0628
Refactor codes for scm model
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
151 |
2544
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
152 self.checkSessionFlash(response, |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
153 'Your account was updated successfully') |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
154 |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
155 updated_user = User.get_by_username(uname) |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
156 updated_params = updated_user.get_api_data() |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
157 updated_params.update({'password_confirmation': ''}) |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
158 updated_params.update({'new_password': ''}) |
691
7486da5f0628
Refactor codes for scm model
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
159 |
2544
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
160 params['last_login'] = updated_params['last_login'] |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
161 if name == 'email': |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
162 params['emails'] = [expected] |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
163 if name == 'ldap_dn': |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
164 #cannot update this via form |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
165 params['ldap_dn'] = None |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
166 if name == 'active': |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
167 #my account cannot deactivate account |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
168 params['active'] = True |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
169 if name == 'admin': |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
170 #my account cannot make you an admin ! |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
171 params['admin'] = False |
754
101a407827e8
fixed test that broke admin email address
Marcin Kuzminski <marcin@python-works.com>
parents:
746
diff
changeset
|
172 |
2544
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
173 self.assertEqual(params, updated_params) |
1382
c310e1e1e757
Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
174 |
2544
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
175 finally: |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
176 UserModel().delete('testme') |
691
7486da5f0628
Refactor codes for scm model
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
177 |
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
|
178 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
|
179 self.log_user() |
691
7486da5f0628
Refactor codes for scm model
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
180 |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
181 new_email = 'test_regular@mail.com' # already exisitn email |
2544
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
182 response = self.app.put(url('admin_settings_my_account_update'), |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
183 params=dict( |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
184 username='test_admin', |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
185 new_password='test12', |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
186 password_confirmation='test122', |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
187 firstname='NewName', |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
188 lastname='NewLastname', |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
189 email=new_email,) |
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
190 ) |
691
7486da5f0628
Refactor codes for scm model
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
191 |
2544
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
192 response.mustcontain('This e-mail address is already taken') |
691
7486da5f0628
Refactor codes for scm model
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
193 |
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
|
194 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
|
195 self.log_user('test_regular2', 'test12') |
691
7486da5f0628
Refactor codes for scm model
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
196 |
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
|
197 new_email = 'newmail.pl' |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
198 response = self.app.post(url('admin_settings_my_account_update'), |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
199 params=dict( |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
200 _method='put', |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
201 username='test_admin', |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
202 new_password='test12', |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
203 password_confirmation='test122', |
2544
6ce3387bf0ce
Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
204 firstname='NewName', |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
205 lastname='NewLastname', |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
206 email=new_email,) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
207 ) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
208 |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
209 response.mustcontain('An email address must contain a single @') |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
210 from rhodecode.model import validators |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
211 msg = validators.ValidUsername(edit=False, |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
212 old_data={})._messages['username_exists'] |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
213 msg = h.html_escape(msg % {'username': 'test_admin'}) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
214 response.mustcontain(u"%s" % msg) |
2629
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
215 |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
216 def test_set_repo_fork_has_no_self_id(self): |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
217 self.log_user() |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
218 repo = Repository.get_by_repo_name(HG_REPO) |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
219 response = self.app.get(url('edit_repo', repo_name=HG_REPO)) |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
220 opt = """<option value="%s">vcs_test_git</option>""" % repo.repo_id |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
221 assert opt not in response.body |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
222 |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
223 def test_set_fork_of_repo(self): |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
224 self.log_user() |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
225 repo = Repository.get_by_repo_name(HG_REPO) |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
226 repo2 = Repository.get_by_repo_name(GIT_REPO) |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
227 response = self.app.put(url('repo_as_fork', repo_name=HG_REPO), |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
228 params=dict( |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
229 id_fork_of=repo2.repo_id |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
230 )) |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
231 repo = Repository.get_by_repo_name(HG_REPO) |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
232 repo2 = Repository.get_by_repo_name(GIT_REPO) |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
233 self.checkSessionFlash(response, |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
234 'Marked repo %s as fork of %s' % (repo.repo_name, repo2.repo_name)) |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
235 |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
236 assert repo.fork == repo2 |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
237 response = response.follow() |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
238 # check if given repo is selected |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
239 |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
240 opt = """<option value="%s" selected="selected">%s</option>""" % ( |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
241 repo2.repo_id, repo2.repo_name) |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
242 response.mustcontain(opt) |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
243 |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
244 # clean session flash |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
245 #response = self.app.get(url('edit_repo', repo_name=HG_REPO)) |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
246 |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
247 ## mark it as None |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
248 response = self.app.put(url('repo_as_fork', repo_name=HG_REPO), |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
249 params=dict( |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
250 id_fork_of=None |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
251 )) |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
252 repo = Repository.get_by_repo_name(HG_REPO) |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
253 repo2 = Repository.get_by_repo_name(GIT_REPO) |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
254 self.checkSessionFlash(response, |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
255 'Marked repo %s as fork of %s' % (repo.repo_name, "Nothing")) |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
256 assert repo.fork == None |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
257 |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
258 def test_set_fork_of_same_repo(self): |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
259 self.log_user() |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
260 repo = Repository.get_by_repo_name(HG_REPO) |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
261 response = self.app.put(url('repo_as_fork', repo_name=HG_REPO), |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
262 params=dict( |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
263 id_fork_of=repo.repo_id |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
264 )) |
d2901d906ef3
Fixed issue #501 error on setting set_as_fork to same repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
265 self.checkSessionFlash(response, |
2673
d5e42c00f3c1
white space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
2629
diff
changeset
|
266 'An error occurred during this operation') |