##// END OF EJS Templates
Use master branch on master bookmark to test with travis
marcink -
r3975:69377d1d default
parent child Browse files
Show More
@@ -39,4 +39,4 b' notifications:'
39 39
40 40 branches:
41 41 only:
42 - dev
42 - master
@@ -15,14 +15,17 b' test_u1_id = None'
15 15 _get_group_perms = None
16 16
17 17
18 def permissions_setup_func(group_name='g0', perm='group.read', recursive=True):
18 def permissions_setup_func(group_name='g0', perm='group.read', recursive=True,
19 user_id=None):
19 20 """
20 21 Resets all permissions to perm attribute
21 22 """
23 if not user_id:
24 user_id = test_u1_id
22 25 repos_group = RepoGroup.get_by_group_name(group_name=group_name)
23 26 if not repos_group:
24 27 raise Exception('Cannot get group %s' % group_name)
25 perms_updates = [[test_u1_id, perm, 'user']]
28 perms_updates = [[user_id, perm, 'user']]
26 29 ReposGroupModel()._update_permissions(repos_group,
27 30 perms_updates=perms_updates,
28 31 recursive=recursive,
@@ -99,9 +102,34 b' def test_user_permissions_on_group_with_'
99 102 _check_expected_count(items, repo_items, expected_count(group, True))
100 103
101 104 for name, perm in repo_items:
102 if name == 'g0/g0_3/g0_3_r1_private':
103 yield check_tree_perms, name, perm, group, 'repository.none'
104 else:
105 yield check_tree_perms, name, perm, group, 'repository.write'
106
107 for name, perm in items:
108 yield check_tree_perms, name, perm, group, 'group.write'
109
110
111 @with_setup(permissions_setup_func)
112 def test_user_permissions_on_group_with_recursive_mode_for_default_user():
113
114 # set permission to g0 recursive mode, all children including
115 # other repos and groups should have this permission now set !
116 recursive = True
117 group = 'g0'
118 default_user_id = User.get_default_user().user_id
119 permissions_setup_func(group, 'group.write', recursive=recursive,
120 user_id=default_user_id)
121
122 # change default to get perms for default user
123 _get_repo_perms = functools.partial(_get_perms, key='repositories',
124 test_u1_id=default_user_id)
125 _get_group_perms = functools.partial(_get_perms, key='repositories_groups',
126 test_u1_id=default_user_id)
127
128 repo_items = [x for x in _get_repo_perms(group, recursive)]
129 items = [x for x in _get_group_perms(group, recursive)]
130 _check_expected_count(items, repo_items, expected_count(group, True))
131
132 for name, perm in repo_items:
105 133 yield check_tree_perms, name, perm, group, 'repository.write'
106 134
107 135 for name, perm in items:
General Comments 0
You need to be logged in to leave comments. Login now