aboutsummaryrefslogtreecommitdiff
path: root/gitosis/test/test_serve.py
diff options
context:
space:
mode:
Diffstat (limited to 'gitosis/test/test_serve.py')
-rw-r--r--gitosis/test/test_serve.py50
1 files changed, 46 insertions, 4 deletions
diff --git a/gitosis/test/test_serve.py b/gitosis/test/test_serve.py
index f1c1930..4b414c4 100644
--- a/gitosis/test/test_serve.py
+++ b/gitosis/test/test_serve.py
@@ -199,7 +199,24 @@ def test_simple_read_dash():
)
eq(got, "git-upload-pack '%s/foo.git'" % tmp)
-def test_simple_read_space():
+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()
@@ -211,11 +228,11 @@ def test_simple_read_space():
got = serve.serve(
cfg=cfg,
user='jdoe',
- command="git upload-pack 'foo'",
+ command="git-upload-pack '/foo'",
)
- eq(got, "git upload-pack '%s/foo.git'" % tmp)
+ eq(got, "git-upload-pack '%s/foo.git'" % tmp)
-def test_simple_write_dash():
+def test_simple_write():
tmp = util.maketemp()
repository.init(os.path.join(tmp, 'foo.git'))
cfg = RawConfigParser()
@@ -317,6 +334,31 @@ def test_push_inits_subdir_parent_missing():
eq(os.listdir(foo), ['bar.git'])
assert os.path.isfile(os.path.join(repositories, 'foo', 'bar.git', 'HEAD'))
+def test_push_inits_subdir_parent_missing_custom_perms():
+ tmp = util.maketemp()
+ cfg = RawConfigParser()
+ cfg.add_section('gitosis')
+ repositories = os.path.join(tmp, 'repositories')
+ os.mkdir(repositories)
+ cfg.set('gitosis', 'repositories', repositories)
+ cfg.set('gitosis', 'dirmode', '0711')
+ generated = os.path.join(tmp, 'generated')
+ os.mkdir(generated)
+ cfg.set('gitosis', 'generate-files-in', generated)
+ cfg.add_section('group foo')
+ cfg.set('group foo', 'members', 'jdoe')
+ cfg.set('group foo', 'writable', 'foo/bar')
+ serve.serve(
+ cfg=cfg,
+ user='jdoe',
+ command="git-receive-pack 'foo/bar.git'",
+ )
+ eq(os.listdir(repositories), ['foo'])
+ foo = os.path.join(repositories, 'foo')
+ util.check_mode(foo, 0711, is_dir=True)
+ eq(os.listdir(foo), ['bar.git'])
+ assert os.path.isfile(os.path.join(repositories, 'foo', 'bar.git', 'HEAD'))
+
def test_push_inits_subdir_parent_exists():
tmp = util.maketemp()
cfg = RawConfigParser()