aboutsummaryrefslogtreecommitdiff
path: root/gitosis/test/test_serve.py
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2007-12-28 03:46:05 -0800
committerRobin H. Johnson <robbat2@gentoo.org>2007-12-28 03:46:05 -0800
commitc7fa5ecce6a4b4766a956d46dea64f5a194ec4df (patch)
tree72c911b3365bf2c032dabf8962d58cff10c017e6 /gitosis/test/test_serve.py
parentAdd testcode for gitosis.dirmode setting. (diff)
downloadgitosis-dakkar-c7fa5ecce6a4b4766a956d46dea64f5a194ec4df.tar.gz
gitosis-dakkar-c7fa5ecce6a4b4766a956d46dea64f5a194ec4df.tar.bz2
gitosis-dakkar-c7fa5ecce6a4b4766a956d46dea64f5a194ec4df.zip
Allow some slashes, to provide support for git+ssh:// URLs that always have a leading slash.
Diffstat (limited to 'gitosis/test/test_serve.py')
-rw-r--r--gitosis/test/test_serve.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/gitosis/test/test_serve.py b/gitosis/test/test_serve.py
index f5785f5..deb9637 100644
--- a/gitosis/test/test_serve.py
+++ b/gitosis/test/test_serve.py
@@ -117,6 +117,39 @@ def test_simple_read():
)
eq(got, "git-upload-pack '%s/foo.git'" % tmp)
+def test_simple_read_absolute():
+ tmp = util.maketemp()
+ full_path = os.path.join(tmp, 'foo.git')
+ repository.init(full_path)
+ cfg = RawConfigParser()
+ cfg.add_section('gitosis')
+ cfg.set('gitosis', 'repositories', tmp)
+ cfg.add_section('group foo')
+ cfg.set('group foo', 'members', 'jdoe')
+ cfg.set('group foo', 'readonly', 'foo')
+ got = serve.serve(
+ cfg=cfg,
+ user='jdoe',
+ command="git-upload-pack '%s'" % (full_path, ),
+ )
+ eq(got, "git-upload-pack '%s/foo.git'" % tmp)
+
+def test_simple_read_leading_slash():
+ tmp = util.maketemp()
+ repository.init(os.path.join(tmp, 'foo.git'))
+ cfg = RawConfigParser()
+ cfg.add_section('gitosis')
+ cfg.set('gitosis', 'repositories', tmp)
+ cfg.add_section('group foo')
+ cfg.set('group foo', 'members', 'jdoe')
+ cfg.set('group foo', 'readonly', 'foo')
+ got = serve.serve(
+ cfg=cfg,
+ user='jdoe',
+ command="git-upload-pack '/foo'",
+ )
+ eq(got, "git-upload-pack '%s/foo.git'" % tmp)
+
def test_simple_write():
tmp = util.maketemp()
repository.init(os.path.join(tmp, 'foo.git'))