annotate rhodecode/tests/functional/test_admin_users_groups.py @ 1718:f78bee8eec78 beta

reduce cookie size for better support of client side sessions
author Marcin Kuzminski <marcin@python-works.com>
date Fri, 25 Nov 2011 19:25:10 +0200
parents 54687aa00724
children 8ecc6b8229a5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
956
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
1 from rhodecode.tests import *
1436
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
2 from rhodecode.model.db import UsersGroup
956
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
3
1382
c310e1e1e757 Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents: 956
diff changeset
4 TEST_USERS_GROUP = 'admins_test'
c310e1e1e757 Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents: 956
diff changeset
5
c310e1e1e757 Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents: 956
diff changeset
6 class TestAdminUsersGroupsController(TestController):
956
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
7
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
8 def test_index(self):
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
9 response = self.app.get(url('users_groups'))
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
10 # Test response...
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
11
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
12 def test_index_as_xml(self):
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
13 response = self.app.get(url('formatted_users_groups', format='xml'))
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
14
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
15 def test_create(self):
1398
6dee43453f58 added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents: 1382
diff changeset
16 self.log_user()
1382
c310e1e1e757 Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents: 956
diff changeset
17 users_group_name = TEST_USERS_GROUP
c310e1e1e757 Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents: 956
diff changeset
18 response = self.app.post(url('users_groups'),
c310e1e1e757 Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents: 956
diff changeset
19 {'users_group_name':users_group_name,
c310e1e1e757 Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents: 956
diff changeset
20 'active':True})
c310e1e1e757 Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents: 956
diff changeset
21 response.follow()
c310e1e1e757 Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents: 956
diff changeset
22
c310e1e1e757 Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents: 956
diff changeset
23 self.checkSessionFlash(response,
c310e1e1e757 Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents: 956
diff changeset
24 'created users group %s' % TEST_USERS_GROUP)
c310e1e1e757 Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents: 956
diff changeset
25
c310e1e1e757 Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents: 956
diff changeset
26
c310e1e1e757 Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents: 956
diff changeset
27
c310e1e1e757 Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents: 956
diff changeset
28
956
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
29
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
30 def test_new(self):
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
31 response = self.app.get(url('new_users_group'))
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
32
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
33 def test_new_as_xml(self):
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
34 response = self.app.get(url('formatted_new_users_group', format='xml'))
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
35
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
36 def test_update(self):
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
37 response = self.app.put(url('users_group', id=1))
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
38
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
39 def test_update_browser_fakeout(self):
1436
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
40 response = self.app.post(url('users_group', id=1),
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
41 params=dict(_method='put'))
956
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
42
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
43 def test_delete(self):
1436
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
44 self.log_user()
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
45 users_group_name = TEST_USERS_GROUP + 'another'
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
46 response = self.app.post(url('users_groups'),
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
47 {'users_group_name':users_group_name,
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
48 'active':True})
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
49 response.follow()
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
50
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
51 self.checkSessionFlash(response,
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
52 'created users group %s' % users_group_name)
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
53
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
54
1713
54687aa00724 Tests updates, Session refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 1436
diff changeset
55 gr = self.Session().query(UsersGroup)\
1436
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
56 .filter(UsersGroup.users_group_name ==
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
57 users_group_name).one()
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
58
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
59 response = self.app.delete(url('users_group', id=gr.users_group_id))
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
60
1713
54687aa00724 Tests updates, Session refactoring
Marcin Kuzminski <marcin@python-works.com>
parents: 1436
diff changeset
61 gr = self.Session().query(UsersGroup)\
1436
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
62 .filter(UsersGroup.users_group_name ==
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
63 users_group_name).scalar()
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
64
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
65 self.assertEqual(gr, None)
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
66
956
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
67
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
68 def test_delete_browser_fakeout(self):
1436
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
69 response = self.app.post(url('users_group', id=1),
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
70 params=dict(_method='delete'))
956
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
71
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
72 def test_show(self):
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
73 response = self.app.get(url('users_group', id=1))
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
74
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
75 def test_show_as_xml(self):
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
76 response = self.app.get(url('formatted_users_group', id=1, format='xml'))
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
77
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
78 def test_edit(self):
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
79 response = self.app.get(url('edit_users_group', id=1))
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
80
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
81 def test_edit_as_xml(self):
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
82 response = self.app.get(url('formatted_edit_users_group', id=1, format='xml'))
1382
c310e1e1e757 Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents: 956
diff changeset
83
c310e1e1e757 Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents: 956
diff changeset
84 def test_assign_members(self):
c310e1e1e757 Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents: 956
diff changeset
85 pass
c310e1e1e757 Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents: 956
diff changeset
86
c310e1e1e757 Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents: 956
diff changeset
87 def test_add_create_permission(self):
c310e1e1e757 Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents: 956
diff changeset
88 pass
c310e1e1e757 Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents: 956
diff changeset
89
c310e1e1e757 Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents: 956
diff changeset
90 def test_revoke_members(self):
c310e1e1e757 Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents: 956
diff changeset
91 pass
c310e1e1e757 Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents: 956
diff changeset
92
c310e1e1e757 Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents: 956
diff changeset
93
c310e1e1e757 Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents: 956
diff changeset
94
c310e1e1e757 Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents: 956
diff changeset
95