diff --git a/kallithea/model/user_group.py b/kallithea/model/user_group.py --- a/kallithea/model/user_group.py +++ b/kallithea/model/user_group.py @@ -152,7 +152,7 @@ class UserGroupModel(BaseModel): def delete(self, user_group, force=False): """ - Deletes repository group, unless force flag is used + Deletes user group, unless force flag is used raises exception if there are members in that group, else deletes group and users @@ -164,10 +164,11 @@ class UserGroupModel(BaseModel): # check if this group is not assigned to repo assigned_groups = UserGroupRepoToPerm.query()\ .filter(UserGroupRepoToPerm.users_group == user_group).all() + assigned_groups = [x.repository.repo_name for x in assigned_groups] if assigned_groups and not force: raise UserGroupsAssignedException( - 'RepoGroup assigned to %s' % assigned_groups) + 'User Group assigned to %s' % ", ".join(assigned_groups)) self.sa.delete(user_group) except Exception: log.error(traceback.format_exc()) diff --git a/kallithea/tests/api/api_base.py b/kallithea/tests/api/api_base.py --- a/kallithea/tests/api/api_base.py +++ b/kallithea/tests/api/api_base.py @@ -1568,7 +1568,7 @@ class BaseTestApi(object): gr_id = ugroup.users_group_id ugr_to_perm = RepoModel().grant_user_group_permission(self.REPO, gr_name, 'repository.write') - msg = 'RepoGroup assigned to [%s]' % (ugr_to_perm) + msg = 'User Group assigned to %s' % ugr_to_perm.repository.repo_name id_, params = _build_data(self.apikey, 'delete_user_group', usergroupid=gr_name,