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.py66
1 files changed, 66 insertions, 0 deletions
diff --git a/gitosis/test/test_serve.py b/gitosis/test/test_serve.py
index 2372429..b842bdf 100644
--- a/gitosis/test/test_serve.py
+++ b/gitosis/test/test_serve.py
@@ -258,3 +258,69 @@ def test_push_inits_no_stdout_spam():
eq(got, '')
eq(os.listdir(tmp), ['foo.git'])
assert os.path.isfile(os.path.join(tmp, 'foo.git', 'HEAD'))
+
+def test_push_inits_sets_description():
+ tmp = util.maketemp()
+ 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', 'writable', 'foo')
+ cfg.add_section('repo foo')
+ cfg.set('repo foo', 'description', 'foodesc')
+ serve.serve(
+ cfg=cfg,
+ user='jdoe',
+ command="git-receive-pack 'foo'",
+ )
+ eq(os.listdir(tmp), ['foo.git'])
+ path = os.path.join(tmp, 'foo.git', 'description')
+ assert os.path.exists(path)
+ got = util.readFile(path)
+ eq(got, 'foodesc\n')
+
+def test_push_inits_updates_projects_list():
+ tmp = util.maketemp()
+ os.mkdir(os.path.join(tmp, 'gitosis-admin.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', 'writable', 'foo')
+ cfg.add_section('repo foo')
+ cfg.set('repo foo', 'gitweb', 'yes')
+ serve.serve(
+ cfg=cfg,
+ user='jdoe',
+ command="git-receive-pack 'foo'",
+ )
+ eq(
+ sorted(os.listdir(tmp)),
+ sorted(['foo.git', 'gitosis-admin.git']),
+ )
+ path = os.path.join(tmp, 'gitosis-admin.git', 'projects.list')
+ assert os.path.exists(path)
+ got = util.readFile(path)
+ eq(got, 'foo.git\n')
+
+def test_push_inits_sets_export_ok():
+ tmp = util.maketemp()
+ 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', 'writable', 'foo')
+ cfg.add_section('repo foo')
+ cfg.set('repo foo', 'daemon', 'yes')
+ serve.serve(
+ cfg=cfg,
+ user='jdoe',
+ command="git-receive-pack 'foo'",
+ )
+ eq(os.listdir(tmp), ['foo.git'])
+ path = os.path.join(tmp, 'foo.git', 'git-daemon-export-ok')
+ assert os.path.exists(path)
+