diff --git a/rhodecode/tests/models/test_permissions.py b/rhodecode/tests/models/test_permissions.py --- a/rhodecode/tests/models/test_permissions.py +++ b/rhodecode/tests/models/test_permissions.py @@ -54,21 +54,21 @@ class TestPermissions(object): # TODO: User creation is a duplicate of test_nofitications, check # if that can be unified self.u1 = UserModel().create_or_update( - username=u'u1', password=u'qweqwe', - email=u'u1@rhodecode.org', firstname=u'u1', lastname=u'u1' + username='u1', password='qweqwe', + email='u1@rhodecode.org', firstname='u1', lastname='u1' ) self.u2 = UserModel().create_or_update( - username=u'u2', password=u'qweqwe', - email=u'u2@rhodecode.org', firstname=u'u2', lastname=u'u2' + username='u2', password='qweqwe', + email='u2@rhodecode.org', firstname='u2', lastname='u2' ) self.u3 = UserModel().create_or_update( - username=u'u3', password=u'qweqwe', - email=u'u3@rhodecode.org', firstname=u'u3', lastname=u'u3' + username='u3', password='qweqwe', + email='u3@rhodecode.org', firstname='u3', lastname='u3' ) self.anon = User.get_default_user() self.a1 = UserModel().create_or_update( - username=u'a1', password=u'qweqwe', - email=u'a1@rhodecode.org', firstname=u'a1', lastname=u'a1', + username='a1', password='qweqwe', + email='a1@rhodecode.org', firstname='a1', lastname='a1', admin=True ) Session().commit() @@ -180,12 +180,11 @@ class TestPermissions(object): repo_type='hg', repo_group=self.g1, cur_user=self.u1,) - assert repo_perms(self.anon) == { - repo_name_in_group: 'repository.read', - 'vcs_test_git': 'repository.read', - 'vcs_test_hg': 'repository.read', - 'vcs_test_svn': 'repository.read', - } + assert repo_perms(self.anon)[repo_name_in_group] == 'repository.read' + assert repo_perms(self.anon)['vcs_test_git'] == 'repository.read' + assert repo_perms(self.anon)['vcs_test_hg'] == 'repository.read' + assert repo_perms(self.anon)['vcs_test_svn'] == 'repository.read' + # Now change default user permissions new_perm = 'repository.write' perm_updates = [ @@ -195,12 +194,10 @@ class TestPermissions(object): repo_group=self.g1, perm_updates=perm_updates, recursive='all') Session().commit() - assert repo_perms(self.anon) == { - repo_name_in_group: new_perm, - 'vcs_test_git': 'repository.read', - 'vcs_test_hg': 'repository.read', - 'vcs_test_svn': 'repository.read', - } + assert repo_perms(self.anon)[repo_name_in_group] == new_perm + assert repo_perms(self.anon)['vcs_test_git'] == 'repository.read' + assert repo_perms(self.anon)['vcs_test_hg'] == 'repository.read' + assert repo_perms(self.anon)['vcs_test_svn'] == 'repository.read' # NOW MARK repo as private changes = { @@ -211,12 +208,10 @@ class TestPermissions(object): Session().commit() # Private repo sets 'none' permission for default user - assert repo_perms(self.anon) == { - repo_name_in_group: 'repository.none', - 'vcs_test_git': 'repository.read', - 'vcs_test_hg': 'repository.read', - 'vcs_test_svn': 'repository.read', - } + assert repo_perms(self.anon)[repo_name_in_group] == 'repository.none' + assert repo_perms(self.anon)['vcs_test_git'] == 'repository.read' + assert repo_perms(self.anon)['vcs_test_hg'] == 'repository.read' + assert repo_perms(self.anon)['vcs_test_svn'] == 'repository.read' # apply same logic of "updated" recursive, but now the anon permissions should be not be impacted new_perm = 'repository.write' @@ -227,12 +222,10 @@ class TestPermissions(object): repo_group=self.g1, perm_updates=perm_updates, recursive='all') Session().commit() - assert repo_perms(self.anon) == { - repo_name_in_group: 'repository.none', - 'vcs_test_git': 'repository.read', - 'vcs_test_hg': 'repository.read', - 'vcs_test_svn': 'repository.read', - } + assert repo_perms(self.anon)[repo_name_in_group] == 'repository.none' + assert repo_perms(self.anon)['vcs_test_git'] == 'repository.read' + assert repo_perms(self.anon)['vcs_test_hg'] == 'repository.read' + assert repo_perms(self.anon)['vcs_test_svn'] == 'repository.read' def test_propagated_permission_from_users_group_by_explicit_perms_exist( self, repo_name): @@ -301,10 +294,10 @@ class TestPermissions(object): self.g2 = fixture.create_repo_group('group2', skip_if_exists=True) # both perms should be read ! assert group_perms(self.u1) == \ - {u'group1': u'group.read', u'group2': u'group.read'} + {'group1': 'group.read', 'group2': 'group.read'} assert group_perms(self.anon) == \ - {u'group1': u'group.read', u'group2': u'group.read'} + {'group1': 'group.read', 'group2': 'group.read'} # Change perms to none for both groups RepoGroupModel().grant_user_permission( @@ -313,9 +306,9 @@ class TestPermissions(object): repo_group=self.g2, user=self.anon, perm='group.none') assert group_perms(self.u1) == \ - {u'group1': u'group.none', u'group2': u'group.none'} + {'group1': 'group.none', 'group2': 'group.none'} assert group_perms(self.anon) == \ - {u'group1': u'group.none', u'group2': u'group.none'} + {'group1': 'group.none', 'group2': 'group.none'} # add repo to group name = RepoGroup.url_sep().join([self.g1.group_name, 'test_perm']) @@ -325,9 +318,9 @@ class TestPermissions(object): cur_user=self.u1,) assert group_perms(self.u1) == \ - {u'group1': u'group.none', u'group2': u'group.none'} + {'group1': 'group.none', 'group2': 'group.none'} assert group_perms(self.anon) == \ - {u'group1': u'group.none', u'group2': u'group.none'} + {'group1': 'group.none', 'group2': 'group.none'} # grant permission for u2 ! RepoGroupModel().grant_user_permission( @@ -339,16 +332,16 @@ class TestPermissions(object): # u1 and anon should have not change perms while u2 should ! assert group_perms(self.u1) == \ - {u'group1': u'group.none', u'group2': u'group.none'} + {'group1': 'group.none', 'group2': 'group.none'} assert group_perms(self.u2) == \ - {u'group1': u'group.read', u'group2': u'group.read'} + {'group1': 'group.read', 'group2': 'group.read'} assert group_perms(self.anon) == \ - {u'group1': u'group.none', u'group2': u'group.none'} + {'group1': 'group.none', 'group2': 'group.none'} def test_repo_group_user_as_user_group_member(self): # create Group1 self.g1 = fixture.create_repo_group('group1', skip_if_exists=True) - assert group_perms(self.anon) == {u'group1': u'group.read'} + assert group_perms(self.anon) == {'group1': 'group.read'} # set default permission to none RepoGroupModel().grant_user_permission( @@ -368,8 +361,8 @@ class TestPermissions(object): # add some user to that group # check his permissions - assert group_perms(self.anon) == {u'group1': u'group.none'} - assert group_perms(self.u1) == {u'group1': u'group.none'} + assert group_perms(self.anon) == {'group1': 'group.none'} + assert group_perms(self.u1) == {'group1': 'group.none'} # grant ug1 read permissions for RepoGroupModel().grant_user_group_permission( @@ -383,8 +376,8 @@ class TestPermissions(object): .scalar() assert obj.permission.permission_name == 'group.read' - assert group_perms(self.anon) == {u'group1': u'group.none'} - assert group_perms(self.u1) == {u'group1': u'group.read'} + assert group_perms(self.anon) == {'group1': 'group.none'} + assert group_perms(self.u1) == {'group1': 'group.read'} def test_inherited_permissions_from_default_on_user_enabled(self): # enable fork and create on default user @@ -598,7 +591,7 @@ class TestPermissions(object): # Make him owner of the repo group self.g1.user = self.u1 - assert group_perms(self.u1) == {u'test1': 'group.admin'} + assert group_perms(self.u1) == {'test1': 'group.admin'} def assert_user_perm_equal( self, user, change_factor=0, compare_keys=None): diff --git a/rhodecode/tests/rhodecode.ini b/rhodecode/tests/rhodecode.ini --- a/rhodecode/tests/rhodecode.ini +++ b/rhodecode/tests/rhodecode.ini @@ -229,7 +229,7 @@ license_token = abra-cada-bra1-rce3 license.hide_license_info = false ; Import EE license from this license path -#license.import_path = %(here)s/rhodecode_enterprise.license +license.import_path = %(here)s/rhodecode_enterprise.license ; import license 'if-missing' or 'force' (always override) ; if-missing means apply license if it doesn't exist. 'force' option always overrides it @@ -645,7 +645,7 @@ vcs.scm_app_implementation = http ; `http` - use http-rpc backend (default) ; `celery` - use celery based hooks #DEPRECATED:vcs.hooks.protocol = http -vcs.hooks.protocol = http +vcs.hooks.protocol.v2 = celery ; Host on which this instance is listening for hooks. vcsserver will call this host to pull/push hooks so it should be ; accessible via network.