本文整理汇总了Python中gitosis.config.GitosisRawConfigParser.read方法的典型用法代码示例。如果您正苦于以下问题:Python GitosisRawConfigParser.read方法的具体用法?Python GitosisRawConfigParser.read怎么用?Python GitosisRawConfigParser.read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gitosis.config.GitosisRawConfigParser
的用法示例。
在下文中一共展示了GitosisRawConfigParser.read方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_init_admin_repository
# 需要导入模块: from gitosis.config import GitosisRawConfigParser [as 别名]
# 或者: from gitosis.config.GitosisRawConfigParser import read [as 别名]
def test_init_admin_repository():
tmp = maketemp()
admin_repository = os.path.join(tmp, 'admin.git')
pubkey = (
'ssh-somealgo '
+'0123456789ABCDEFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
+'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
+'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
+'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= [email protected]')
user = 'jdoe'
cfg = GitosisRawConfigParser()
init.init_admin_repository(
git_dir=admin_repository,
pubkey=pubkey,
user=user,
config=cfg,
)
eq(os.listdir(tmp), ['admin.git'])
hook = os.path.join(
tmp,
'admin.git',
'hooks',
'post-update',
)
util.check_mode(hook, 0755, is_file=True)
got = util.readFile(hook).splitlines()
assert 'gitosis-run-hook post-update' in got
export_dir = os.path.join(tmp, 'export')
repository.export(git_dir=admin_repository,
path=export_dir)
eq(sorted(os.listdir(export_dir)),
sorted(['gitosis.conf', 'keydir']))
eq(os.listdir(os.path.join(export_dir, 'keydir')),
['jdoe.pub'])
got = util.readFile(
os.path.join(export_dir, 'keydir', 'jdoe.pub'))
eq(got, pubkey)
# the only thing guaranteed of initial config file ordering is
# that [gitosis] is first
got = util.readFile(os.path.join(export_dir, 'gitosis.conf'))
# We can't gaurentee this anymore
got = got.splitlines()[0]
eq(got, '[gitosis]')
cfg.read(os.path.join(export_dir, 'gitosis.conf'))
eq(sorted(cfg.sections()),
sorted([
'gitosis',
'group gitosis-admin',
]))
eq(cfg.items('gitosis'), [])
eq(sorted(cfg.items('group gitosis-admin')),
sorted([
('writable', 'gitosis-admin'),
('members', 'jdoe'),
]))