changeset 7298:ebc239a474a3

tests: clarify that fixture.create_repo_group takes a name, not a path Don't pass a path on to the model layer - it can't and won't handle it correctly.
author Mads Kiilerich <mads@kiilerich.com>
date Tue, 29 May 2018 12:25:43 +0200
parents 552170092d06
children 57a733313e4f
files kallithea/tests/api/api_base.py kallithea/tests/fixture.py
diffstat 2 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/tests/api/api_base.py	Tue May 29 12:25:42 2018 +0200
+++ b/kallithea/tests/api/api_base.py	Tue May 29 12:25:43 2018 +0200
@@ -1128,10 +1128,13 @@
         fixture.destroy_repo_group(repo_group_name)
 
     def test_api_create_repo_in_repo_group_without_permission(self):
-        repo_group_name = u'%s/api-repo-repo' % TEST_REPO_GROUP
+        repo_group_basename = u'api-repo-repo'
+        repo_group_name = u'%s/%s' % (TEST_REPO_GROUP, repo_group_basename)
         repo_name = u'%s/api-repo' % repo_group_name
 
-        rg = fixture.create_repo_group(repo_group_name)
+        top_group = RepoGroup.get_by_group_name(TEST_REPO_GROUP)
+        assert top_group
+        rg = fixture.create_repo_group(repo_group_basename, group_parent_id=top_group)
         Session().commit()
         RepoGroupModel().grant_user_permission(repo_group_name,
                                                self.TEST_USER_LOGIN,
--- a/kallithea/tests/fixture.py	Tue May 29 12:25:42 2018 +0200
+++ b/kallithea/tests/fixture.py	Tue May 29 12:25:43 2018 +0200
@@ -194,6 +194,7 @@
         Session().commit()
 
     def create_repo_group(self, name, parent_group_id=None, **kwargs):
+        assert '/' not in name, (name, kwargs) # use group_parent_id to make nested groups
         if 'skip_if_exists' in kwargs:
             del kwargs['skip_if_exists']
             gr = RepoGroup.get_by_group_name(group_name=name)