##// END OF EJS Templates
fix(tests): fixed few tests
super-admin -
r5575:521d91fe default
parent child Browse files
Show More
@@ -54,21 +54,21 b' class TestPermissions(object):'
54 54 # TODO: User creation is a duplicate of test_nofitications, check
55 55 # if that can be unified
56 56 self.u1 = UserModel().create_or_update(
57 username=u'u1', password=u'qweqwe',
58 email=u'u1@rhodecode.org', firstname=u'u1', lastname=u'u1'
57 username='u1', password='qweqwe',
58 email='u1@rhodecode.org', firstname='u1', lastname='u1'
59 59 )
60 60 self.u2 = UserModel().create_or_update(
61 username=u'u2', password=u'qweqwe',
62 email=u'u2@rhodecode.org', firstname=u'u2', lastname=u'u2'
61 username='u2', password='qweqwe',
62 email='u2@rhodecode.org', firstname='u2', lastname='u2'
63 63 )
64 64 self.u3 = UserModel().create_or_update(
65 username=u'u3', password=u'qweqwe',
66 email=u'u3@rhodecode.org', firstname=u'u3', lastname=u'u3'
65 username='u3', password='qweqwe',
66 email='u3@rhodecode.org', firstname='u3', lastname='u3'
67 67 )
68 68 self.anon = User.get_default_user()
69 69 self.a1 = UserModel().create_or_update(
70 username=u'a1', password=u'qweqwe',
71 email=u'a1@rhodecode.org', firstname=u'a1', lastname=u'a1',
70 username='a1', password='qweqwe',
71 email='a1@rhodecode.org', firstname='a1', lastname='a1',
72 72 admin=True
73 73 )
74 74 Session().commit()
@@ -180,12 +180,11 b' class TestPermissions(object):'
180 180 repo_type='hg',
181 181 repo_group=self.g1,
182 182 cur_user=self.u1,)
183 assert repo_perms(self.anon) == {
184 repo_name_in_group: 'repository.read',
185 'vcs_test_git': 'repository.read',
186 'vcs_test_hg': 'repository.read',
187 'vcs_test_svn': 'repository.read',
188 }
183 assert repo_perms(self.anon)[repo_name_in_group] == 'repository.read'
184 assert repo_perms(self.anon)['vcs_test_git'] == 'repository.read'
185 assert repo_perms(self.anon)['vcs_test_hg'] == 'repository.read'
186 assert repo_perms(self.anon)['vcs_test_svn'] == 'repository.read'
187
189 188 # Now change default user permissions
190 189 new_perm = 'repository.write'
191 190 perm_updates = [
@@ -195,12 +194,10 b' class TestPermissions(object):'
195 194 repo_group=self.g1, perm_updates=perm_updates, recursive='all')
196 195
197 196 Session().commit()
198 assert repo_perms(self.anon) == {
199 repo_name_in_group: new_perm,
200 'vcs_test_git': 'repository.read',
201 'vcs_test_hg': 'repository.read',
202 'vcs_test_svn': 'repository.read',
203 }
197 assert repo_perms(self.anon)[repo_name_in_group] == new_perm
198 assert repo_perms(self.anon)['vcs_test_git'] == 'repository.read'
199 assert repo_perms(self.anon)['vcs_test_hg'] == 'repository.read'
200 assert repo_perms(self.anon)['vcs_test_svn'] == 'repository.read'
204 201
205 202 # NOW MARK repo as private
206 203 changes = {
@@ -211,12 +208,10 b' class TestPermissions(object):'
211 208 Session().commit()
212 209
213 210 # Private repo sets 'none' permission for default user
214 assert repo_perms(self.anon) == {
215 repo_name_in_group: 'repository.none',
216 'vcs_test_git': 'repository.read',
217 'vcs_test_hg': 'repository.read',
218 'vcs_test_svn': 'repository.read',
219 }
211 assert repo_perms(self.anon)[repo_name_in_group] == 'repository.none'
212 assert repo_perms(self.anon)['vcs_test_git'] == 'repository.read'
213 assert repo_perms(self.anon)['vcs_test_hg'] == 'repository.read'
214 assert repo_perms(self.anon)['vcs_test_svn'] == 'repository.read'
220 215
221 216 # apply same logic of "updated" recursive, but now the anon permissions should be not be impacted
222 217 new_perm = 'repository.write'
@@ -227,12 +222,10 b' class TestPermissions(object):'
227 222 repo_group=self.g1, perm_updates=perm_updates, recursive='all')
228 223
229 224 Session().commit()
230 assert repo_perms(self.anon) == {
231 repo_name_in_group: 'repository.none',
232 'vcs_test_git': 'repository.read',
233 'vcs_test_hg': 'repository.read',
234 'vcs_test_svn': 'repository.read',
235 }
225 assert repo_perms(self.anon)[repo_name_in_group] == 'repository.none'
226 assert repo_perms(self.anon)['vcs_test_git'] == 'repository.read'
227 assert repo_perms(self.anon)['vcs_test_hg'] == 'repository.read'
228 assert repo_perms(self.anon)['vcs_test_svn'] == 'repository.read'
236 229
237 230 def test_propagated_permission_from_users_group_by_explicit_perms_exist(
238 231 self, repo_name):
@@ -301,10 +294,10 b' class TestPermissions(object):'
301 294 self.g2 = fixture.create_repo_group('group2', skip_if_exists=True)
302 295 # both perms should be read !
303 296 assert group_perms(self.u1) == \
304 {u'group1': u'group.read', u'group2': u'group.read'}
297 {'group1': 'group.read', 'group2': 'group.read'}
305 298
306 299 assert group_perms(self.anon) == \
307 {u'group1': u'group.read', u'group2': u'group.read'}
300 {'group1': 'group.read', 'group2': 'group.read'}
308 301
309 302 # Change perms to none for both groups
310 303 RepoGroupModel().grant_user_permission(
@@ -313,9 +306,9 b' class TestPermissions(object):'
313 306 repo_group=self.g2, user=self.anon, perm='group.none')
314 307
315 308 assert group_perms(self.u1) == \
316 {u'group1': u'group.none', u'group2': u'group.none'}
309 {'group1': 'group.none', 'group2': 'group.none'}
317 310 assert group_perms(self.anon) == \
318 {u'group1': u'group.none', u'group2': u'group.none'}
311 {'group1': 'group.none', 'group2': 'group.none'}
319 312
320 313 # add repo to group
321 314 name = RepoGroup.url_sep().join([self.g1.group_name, 'test_perm'])
@@ -325,9 +318,9 b' class TestPermissions(object):'
325 318 cur_user=self.u1,)
326 319
327 320 assert group_perms(self.u1) == \
328 {u'group1': u'group.none', u'group2': u'group.none'}
321 {'group1': 'group.none', 'group2': 'group.none'}
329 322 assert group_perms(self.anon) == \
330 {u'group1': u'group.none', u'group2': u'group.none'}
323 {'group1': 'group.none', 'group2': 'group.none'}
331 324
332 325 # grant permission for u2 !
333 326 RepoGroupModel().grant_user_permission(
@@ -339,16 +332,16 b' class TestPermissions(object):'
339 332
340 333 # u1 and anon should have not change perms while u2 should !
341 334 assert group_perms(self.u1) == \
342 {u'group1': u'group.none', u'group2': u'group.none'}
335 {'group1': 'group.none', 'group2': 'group.none'}
343 336 assert group_perms(self.u2) == \
344 {u'group1': u'group.read', u'group2': u'group.read'}
337 {'group1': 'group.read', 'group2': 'group.read'}
345 338 assert group_perms(self.anon) == \
346 {u'group1': u'group.none', u'group2': u'group.none'}
339 {'group1': 'group.none', 'group2': 'group.none'}
347 340
348 341 def test_repo_group_user_as_user_group_member(self):
349 342 # create Group1
350 343 self.g1 = fixture.create_repo_group('group1', skip_if_exists=True)
351 assert group_perms(self.anon) == {u'group1': u'group.read'}
344 assert group_perms(self.anon) == {'group1': 'group.read'}
352 345
353 346 # set default permission to none
354 347 RepoGroupModel().grant_user_permission(
@@ -368,8 +361,8 b' class TestPermissions(object):'
368 361 # add some user to that group
369 362
370 363 # check his permissions
371 assert group_perms(self.anon) == {u'group1': u'group.none'}
372 assert group_perms(self.u1) == {u'group1': u'group.none'}
364 assert group_perms(self.anon) == {'group1': 'group.none'}
365 assert group_perms(self.u1) == {'group1': 'group.none'}
373 366
374 367 # grant ug1 read permissions for
375 368 RepoGroupModel().grant_user_group_permission(
@@ -383,8 +376,8 b' class TestPermissions(object):'
383 376 .scalar()
384 377 assert obj.permission.permission_name == 'group.read'
385 378
386 assert group_perms(self.anon) == {u'group1': u'group.none'}
387 assert group_perms(self.u1) == {u'group1': u'group.read'}
379 assert group_perms(self.anon) == {'group1': 'group.none'}
380 assert group_perms(self.u1) == {'group1': 'group.read'}
388 381
389 382 def test_inherited_permissions_from_default_on_user_enabled(self):
390 383 # enable fork and create on default user
@@ -598,7 +591,7 b' class TestPermissions(object):'
598 591
599 592 # Make him owner of the repo group
600 593 self.g1.user = self.u1
601 assert group_perms(self.u1) == {u'test1': 'group.admin'}
594 assert group_perms(self.u1) == {'test1': 'group.admin'}
602 595
603 596 def assert_user_perm_equal(
604 597 self, user, change_factor=0, compare_keys=None):
@@ -229,7 +229,7 b' license_token = abra-cada-bra1-rce3'
229 229 license.hide_license_info = false
230 230
231 231 ; Import EE license from this license path
232 #license.import_path = %(here)s/rhodecode_enterprise.license
232 license.import_path = %(here)s/rhodecode_enterprise.license
233 233
234 234 ; import license 'if-missing' or 'force' (always override)
235 235 ; if-missing means apply license if it doesn't exist. 'force' option always overrides it
@@ -645,7 +645,7 b' vcs.scm_app_implementation = http'
645 645 ; `http` - use http-rpc backend (default)
646 646 ; `celery` - use celery based hooks
647 647 #DEPRECATED:vcs.hooks.protocol = http
648 vcs.hooks.protocol = http
648 vcs.hooks.protocol.v2 = celery
649 649
650 650 ; Host on which this instance is listening for hooks. vcsserver will call this host to pull/push hooks so it should be
651 651 ; accessible via network.
General Comments 0
You need to be logged in to leave comments. Login now