本文整理汇总了Python中utils.GerritGitUtils.fetch_meta_config方法的典型用法代码示例。如果您正苦于以下问题:Python GerritGitUtils.fetch_meta_config方法的具体用法?Python GerritGitUtils.fetch_meta_config怎么用?Python GerritGitUtils.fetch_meta_config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utils.GerritGitUtils
的用法示例。
在下文中一共展示了GerritGitUtils.fetch_meta_config方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_create_private_project_as_admin_clone_as_admin
# 需要导入模块: from utils import GerritGitUtils [as 别名]
# 或者: from utils.GerritGitUtils import fetch_meta_config [as 别名]
def test_create_private_project_as_admin_clone_as_admin(self):
""" Clone private project as admin and check content
"""
pname = 'p_%s' % create_random_str()
options = {"private": ""}
self.create_project(pname, config.ADMIN_USER, options=options)
ggu = GerritGitUtils(config.ADMIN_USER,
config.ADMIN_PRIV_KEY_PATH,
config.USERS[config.ADMIN_USER]['email'])
url = "ssh://%[email protected]%s:29418/%s" % (config.ADMIN_USER,
config.GATEWAY_HOST, pname)
clone_dir = ggu.clone(url, pname)
self.dirs_to_delete.append(os.path.dirname(clone_dir))
# Test that the clone is a success
self.assertTrue(os.path.isdir(clone_dir))
# Verify master own the .gitreview file
self.assertTrue(os.path.isfile(os.path.join(clone_dir,
'.gitreview')))
# Verify meta/config branch own both group and ACLs config file
ggu.fetch_meta_config(clone_dir)
self.assertTrue(os.path.isfile(os.path.join(clone_dir,
'project.config')))
self.assertTrue(os.path.isfile(os.path.join(clone_dir,
'groups')))
# There is a group dev for a private project
content = file(os.path.join(clone_dir, 'project.config')).read()
self.assertTrue('%s-dev' % pname in content)
content = file(os.path.join(clone_dir, 'groups')).read()
self.assertTrue('%s-dev' % pname in content)
示例2: test_01_validate_gerrit_project_acls
# 需要导入模块: from utils import GerritGitUtils [as 别名]
# 或者: from utils.GerritGitUtils import fetch_meta_config [as 别名]
def test_01_validate_gerrit_project_acls(self):
""" Verify the correct behavior of ACLs set on
gerrit project
"""
pname = "TestProjectACL"
self.createProject(pname)
un = config.ADMIN_USER
priv_key_path = set_private_key(config.USERS[un]["privkey"])
gitu = GerritGitUtils(un,
priv_key_path,
config.USERS[un]['email'])
url = "ssh://%[email protected]%s:29418/%s" % (un, config.GATEWAY_HOST,
pname)
clone_dir = gitu.clone(url, pname)
gitu.fetch_meta_config(clone_dir)
with open(os.path.join(clone_dir,
'project.config')) as project_config:
p_config = parse_project_config(project_config)
ptl = pname + "-ptl"
core = pname + "-core"
self.assertTrue('access "refs/*"' in p_config.keys(),
repr(p_config))
self.assertTrue('access "refs/heads/*"' in p_config.keys(),
repr(p_config))
self.assertTrue('access "refs/meta/config"' in p_config.keys(),
repr(p_config))
self.assertTrue(any(ptl in l
for l in p_config['access "refs/*"']['owner']),
repr(p_config))
self.assertTrue(any(core in l
for l in p_config['access "refs/*"']['read']),
repr(p_config))
heads = p_config['access "refs/heads/*"']
self.assertTrue(any(core in l
for l in heads['label-Code-Review']),
repr(p_config))
self.assertTrue(any(core in l
for l in heads['label-Workflow']),
repr(p_config))
self.assertTrue(any(ptl in l
for l in heads['label-Verified']),
repr(p_config))
self.assertTrue(any(ptl in l
for l in heads['submit']),
repr(p_config))
self.assertTrue(any(core in l
for l in heads['read']),
repr(p_config))
# no need to test ref/meta/config, we could not test is if we
# could not access it to begin with
self.dirs_to_delete.append(os.path.dirname(clone_dir))
示例3: test_create_public_project_as_admin_clone_as_admin
# 需要导入模块: from utils import GerritGitUtils [as 别名]
# 或者: from utils.GerritGitUtils import fetch_meta_config [as 别名]
def test_create_public_project_as_admin_clone_as_admin(self):
""" Clone public project as admin and check content
"""
pname = "p_%s" % create_random_str()
self.create_project(pname, config.ADMIN_USER)
ggu = GerritGitUtils(config.ADMIN_USER, config.ADMIN_PRIV_KEY_PATH, config.USERS[config.ADMIN_USER]["email"])
url = "ssh://%[email protected]%s:29418/%s" % (config.ADMIN_USER, config.GATEWAY_HOST, pname)
clone_dir = ggu.clone(url, pname)
self.dirs_to_delete.append(os.path.dirname(clone_dir))
# Test that the clone is a success
self.assertTrue(os.path.isdir(clone_dir))
# Verify master own the .gitreview file
self.assertTrue(os.path.isfile(os.path.join(clone_dir, ".gitreview")))
# Verify meta/config branch own both group and ACLs config file
ggu.fetch_meta_config(clone_dir)
self.assertTrue(os.path.isfile(os.path.join(clone_dir, "project.config")))
self.assertTrue(os.path.isfile(os.path.join(clone_dir, "groups")))
# There is no group dev for a public project
content = file(os.path.join(clone_dir, "project.config")).read()
self.assertFalse("%s-dev" % pname in content)
content = file(os.path.join(clone_dir, "groups")).read()
self.assertFalse("%s-dev" % pname in content)