diff options
author | Guido Günther <agx@sigxcpu.org> | 2016-09-09 13:35:41 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2016-09-12 08:52:14 +0200 |
commit | 7a7068d14ab34e47d44bd601db201fb4126751ef (patch) | |
tree | 226d8095fbb4e08d2a389c0d59a51609055e6591 /tests | |
parent | bc187422ddfd561d244e78a8826f58a0ff018713 (diff) |
create_remote_repo: allow to create non bare repositories
Closes: #837158
Diffstat (limited to 'tests')
-rw-r--r-- | tests/27_test_create_remote_repo.py | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/tests/27_test_create_remote_repo.py b/tests/27_test_create_remote_repo.py index 1dce1b2d..8188fb3c 100644 --- a/tests/27_test_create_remote_repo.py +++ b/tests/27_test_create_remote_repo.py @@ -4,12 +4,24 @@ from gbp.scripts.create_remote_repo import (build_remote_script, # noqa: F401 parse_url) # noqa: F401 -def test_template_dir(): +def test_build_remote_script(): """ - >>> build_remote_script({'base': 'base', 'dir': 'dir', 'pkg': 'pkg', 'template-dir': None}, 'branch') - '\\nset -e\\numask 002\\nif [ -d base"dir" ]; then\\n echo "Repository at "basedir" already exists - giving up."\\n exit 1\\nfi\\nmkdir -p base"dir"\\ncd base"dir"\\ngit init --bare --shared\\necho "pkg packaging" > description\\necho "ref: refs/heads/branch" > HEAD\\n' - >>> build_remote_script({'base': 'base', 'dir': 'dir', 'pkg': 'pkg', 'template-dir': '/doesnot/exist'}, 'branch') - '\\nset -e\\numask 002\\nif [ -d base"dir" ]; then\\n echo "Repository at "basedir" already exists - giving up."\\n exit 1\\nfi\\nmkdir -p base"dir"\\ncd base"dir"\\ngit init --bare --shared --template=/doesnot/exist\\necho "pkg packaging" > description\\necho "ref: refs/heads/branch" > HEAD\\n' + >>> build_remote_script({'base': 'base', 'dir': 'dir', 'pkg': 'pkg', 'template-dir': None, 'bare': True}, 'branch') + '\\nset -e\\numask 002\\nif [ -d base"dir" ]; then\\n echo "Repository at "basedir" already exists - giving up."\\n exit 1\\nfi\\nmkdir -p base"dir"\\ncd base"dir"\\ngit init --shared --bare\\necho "pkg packaging" > ./description\\necho "ref: refs/heads/branch" > ./HEAD\\n' + """ + + +def test_build_remote_script_template_dir(): + """ + >>> build_remote_script({'base': 'base', 'dir': 'dir', 'pkg': 'pkg', 'template-dir': '/doesnot/exist', 'bare': True}, 'branch') + '\\nset -e\\numask 002\\nif [ -d base"dir" ]; then\\n echo "Repository at "basedir" already exists - giving up."\\n exit 1\\nfi\\nmkdir -p base"dir"\\ncd base"dir"\\ngit init --shared --bare --template=/doesnot/exist\\necho "pkg packaging" > ./description\\necho "ref: refs/heads/branch" > ./HEAD\\n' + """ + + +def test_build_remote_script_bare(): + """ + >>> build_remote_script({'base': 'base', 'dir': 'dir', 'pkg': 'pkg', 'template-dir': None, 'bare': False}, 'branch') + '\\nset -e\\numask 002\\nif [ -d base"dir" ]; then\\n echo "Repository at "basedir" already exists - giving up."\\n exit 1\\nfi\\nmkdir -p base"dir"\\ncd base"dir"\\ngit init --shared\\necho "pkg packaging" > .git/description\\necho "ref: refs/heads/branch" > .git/HEAD\\n' """ @@ -68,8 +80,10 @@ def test_parse_url(): >>> url['template-dir'] >>> url['url'] 'ssh://host:22/~/path/package.git' + >>> url['bare'] + True - >>> url = parse_url("ssh://host:22/~user/path/%(pkg)s.git", "origin", "package", "/doesnot/exist") + >>> url = parse_url("ssh://host:22/~user/path/%(pkg)s.git", "origin", "package", "/doesnot/exist", bare=False) >>> url['dir'] 'path/package.git' >>> url['host'] @@ -86,6 +100,8 @@ def test_parse_url(): '/doesnot/exist' >>> url['url'] 'ssh://host:22/~user/path/package.git' + >>> url['bare'] + False >>> parse_url("git://host/repo.git", "origin", "package") Traceback (most recent call last): |