annotate rhodecode/tests/functional/test_admin_users_groups.py @ 1818:cf51bbfb120e beta

auto white-space removal
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 29 Dec 2011 07:35:51 +0200
parents 8ecc6b8229a5
children c9adf2a4929a
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
956
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
26 def test_new(self):
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
27 response = self.app.get(url('new_users_group'))
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
28
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
29 def test_new_as_xml(self):
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
30 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
31
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
32 def test_update(self):
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
33 response = self.app.put(url('users_group', id=1))
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
34
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
35 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
36 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
37 params=dict(_method='put'))
956
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_delete(self):
1436
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
40 self.log_user()
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
41 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
42 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
43 {'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
44 'active':True})
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
45 response.follow()
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
46
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
47 self.checkSessionFlash(response,
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
48 '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
49
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
50
1749
8ecc6b8229a5 commit less models
Marcin Kuzminski <marcin@python-works.com>
parents: 1713
diff changeset
51 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
52 .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
53 users_group_name).one()
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
54
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
55 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
56
1749
8ecc6b8229a5 commit less models
Marcin Kuzminski <marcin@python-works.com>
parents: 1713
diff changeset
57 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
58 .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
59 users_group_name).scalar()
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
60
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
61 self.assertEqual(gr, None)
88d13c1c6a55 removed users_group controller in replace for model methods,
Marcin Kuzminski <marcin@python-works.com>
parents: 1398
diff changeset
62
956
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
63
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
64 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
65 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
66 params=dict(_method='delete'))
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_show(self):
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
69 response = self.app.get(url('users_group', id=1))
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
70
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
71 def test_show_as_xml(self):
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
72 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
73
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
74 def test_edit(self):
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
75 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
76
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
77 def test_edit_as_xml(self):
83d35d716a02 started working on issue #56
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
78 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
79
c310e1e1e757 Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents: 956
diff changeset
80 def test_assign_members(self):
c310e1e1e757 Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents: 956
diff changeset
81 pass
c310e1e1e757 Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents: 956
diff changeset
82
c310e1e1e757 Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents: 956
diff changeset
83 def test_add_create_permission(self):
c310e1e1e757 Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents: 956
diff changeset
84 pass
c310e1e1e757 Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents: 956
diff changeset
85
c310e1e1e757 Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents: 956
diff changeset
86 def test_revoke_members(self):
c310e1e1e757 Added CheckSessionFlash into init.
Marcin Kuzminski <marcin@python-works.com>
parents: 956
diff changeset
87 pass