Show More
@@ -0,0 +1,4 b'' | |||||
|
1 | from rhodecode.tests import * | |||
|
2 | ||||
|
3 | class TestReposGroupsController(TestController): | |||
|
4 | pass |
@@ -27,7 +27,8 b' log = logging.getLogger(__name__)' | |||||
27 | import pylons.test |
|
27 | import pylons.test | |
28 |
|
28 | |||
29 | __all__ = ['environ', 'url', 'TestController', 'TESTS_TMP_PATH', 'HG_REPO', |
|
29 | __all__ = ['environ', 'url', 'TestController', 'TESTS_TMP_PATH', 'HG_REPO', | |
30 |
'GIT_REPO', 'NEW_HG_REPO', 'NEW_GIT_REPO', 'HG_FORK', 'GIT_FORK', |
|
30 | 'GIT_REPO', 'NEW_HG_REPO', 'NEW_GIT_REPO', 'HG_FORK', 'GIT_FORK', | |
|
31 | 'checkSessionFlash' ] | |||
31 |
|
32 | |||
32 | # Invoke websetup with the current config file |
|
33 | # Invoke websetup with the current config file | |
33 | #SetupCommand('setup-app').run([config_file]) |
|
34 | #SetupCommand('setup-app').run([config_file]) | |
@@ -72,3 +73,10 b' class TestController(TestCase):' | |||||
72 | self.assertEqual(response.status, '302 Found') |
|
73 | self.assertEqual(response.status, '302 Found') | |
73 | self.assertEqual(response.session['rhodecode_user'].username, username) |
|
74 | self.assertEqual(response.session['rhodecode_user'].username, username) | |
74 | return response.follow() |
|
75 | return response.follow() | |
|
76 | ||||
|
77 | ||||
|
78 | ||||
|
79 | def checkSessionFlash(self, response, msg): | |||
|
80 | self.assertTrue('flash' in response.session) | |||
|
81 | self.assertTrue(msg in response.session['flash'][0][1]) | |||
|
82 |
@@ -61,8 +61,8 b' class TestAdminSettingsController(TestCo' | |||||
61 | rhodecode_ga_code=new_ga_code |
|
61 | rhodecode_ga_code=new_ga_code | |
62 | )) |
|
62 | )) | |
63 |
|
63 | |||
64 |
self. |
|
64 | self.checkSessionFlash(response, 'Updated application settings') | |
65 | response.session['flash'][0][1]) |
|
65 | ||
66 | self.assertEqual(RhodeCodeSettings |
|
66 | self.assertEqual(RhodeCodeSettings | |
67 | .get_app_settings()['rhodecode_ga_code'], new_ga_code) |
|
67 | .get_app_settings()['rhodecode_ga_code'], new_ga_code) | |
68 |
|
68 | |||
@@ -108,9 +108,7 b' class TestAdminSettingsController(TestCo' | |||||
108 | rhodecode_ga_code='' |
|
108 | rhodecode_ga_code='' | |
109 | )) |
|
109 | )) | |
110 |
|
110 | |||
111 |
|
111 | self.checkSessionFlash(response, 'Updated application settings') | ||
112 | self.assertTrue('Updated application settings' in |
|
|||
113 | response.session['flash'][0][1]) |
|
|||
114 | self.assertEqual(RhodeCodeSettings |
|
112 | self.assertEqual(RhodeCodeSettings | |
115 | .get_app_settings()['rhodecode_title'], |
|
113 | .get_app_settings()['rhodecode_title'], | |
116 | new_title.decode('utf-8')) |
|
114 | new_title.decode('utf-8')) | |
@@ -168,7 +166,9 b' class TestAdminSettingsController(TestCo' | |||||
168 | email=old_email,)) |
|
166 | email=old_email,)) | |
169 |
|
167 | |||
170 | response.follow() |
|
168 | response.follow() | |
171 | assert 'Your account was updated successfully' in response.session['flash'][0][1], 'no flash message about success of change' |
|
169 | self.checkSessionFlash(response, | |
|
170 | 'Your account was updated successfully') | |||
|
171 | ||||
172 | user = self.sa.query(User).filter(User.username == 'test_admin').one() |
|
172 | user = self.sa.query(User).filter(User.username == 'test_admin').one() | |
173 | assert user.email == old_email , 'incorrect user email after update got %s vs %s' % (user.email, old_email) |
|
173 | assert user.email == old_email , 'incorrect user email after update got %s vs %s' % (user.email, old_email) | |
174 |
|
174 |
@@ -1,6 +1,8 b'' | |||||
1 | from rhodecode.tests import * |
|
1 | from rhodecode.tests import * | |
2 |
|
2 | |||
3 | class TestUsersGroupsController(TestController): |
|
3 | TEST_USERS_GROUP = 'admins_test' | |
|
4 | ||||
|
5 | class TestAdminUsersGroupsController(TestController): | |||
4 |
|
6 | |||
5 | def test_index(self): |
|
7 | def test_index(self): | |
6 | response = self.app.get(url('users_groups')) |
|
8 | response = self.app.get(url('users_groups')) | |
@@ -10,7 +12,18 b' class TestUsersGroupsController(TestCont' | |||||
10 | response = self.app.get(url('formatted_users_groups', format='xml')) |
|
12 | response = self.app.get(url('formatted_users_groups', format='xml')) | |
11 |
|
13 | |||
12 | def test_create(self): |
|
14 | def test_create(self): | |
13 | response = self.app.post(url('users_groups')) |
|
15 | users_group_name = TEST_USERS_GROUP | |
|
16 | response = self.app.post(url('users_groups'), | |||
|
17 | {'users_group_name':users_group_name, | |||
|
18 | 'active':True}) | |||
|
19 | response.follow() | |||
|
20 | ||||
|
21 | self.checkSessionFlash(response, | |||
|
22 | 'created users group %s' % TEST_USERS_GROUP) | |||
|
23 | ||||
|
24 | ||||
|
25 | ||||
|
26 | ||||
14 |
|
27 | |||
15 | def test_new(self): |
|
28 | def test_new(self): | |
16 | response = self.app.get(url('new_users_group')) |
|
29 | response = self.app.get(url('new_users_group')) | |
@@ -41,3 +54,16 b' class TestUsersGroupsController(TestCont' | |||||
41 |
|
54 | |||
42 | def test_edit_as_xml(self): |
|
55 | def test_edit_as_xml(self): | |
43 | response = self.app.get(url('formatted_edit_users_group', id=1, format='xml')) |
|
56 | response = self.app.get(url('formatted_edit_users_group', id=1, format='xml')) | |
|
57 | ||||
|
58 | def test_assign_members(self): | |||
|
59 | pass | |||
|
60 | ||||
|
61 | def test_add_create_permission(self): | |||
|
62 | pass | |||
|
63 | ||||
|
64 | def test_revoke_members(self): | |||
|
65 | pass | |||
|
66 | ||||
|
67 | ||||
|
68 | ||||
|
69 |
General Comments 0
You need to be logged in to leave comments.
Login now