From 7b99ae75833314a85dc5a1a51183620d917c29d6 Mon Sep 17 00:00:00 2001 From: Tommi Virtanen Date: Mon, 4 Jun 2007 14:22:54 +0300 Subject: Add config option ``repositories``, for giving a path prefix to repositories. Both global and relative (to home directory) values work, can be given in global section ``[gitosis]`` or in the ``[group FOO]`` section for just that group. --- gitosis/test/test_access.py | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'gitosis/test/test_access.py') diff --git a/gitosis/test/test_access.py b/gitosis/test/test_access.py index 00b1fe8..6e41a99 100644 --- a/gitosis/test/test_access.py +++ b/gitosis/test/test_access.py @@ -77,3 +77,46 @@ def test_read_yes_map_wouldHaveWritable(): cfg.set('group fooers', 'map writable foo/bar', 'quux/thud') eq(access.haveAccess(config=cfg, user='jdoe', mode='readonly', path='foo/bar'), None) + +def test_base_global_absolute(): + cfg = RawConfigParser() + cfg.add_section('gitosis') + cfg.set('gitosis', 'repositories', '/a/leading/path') + cfg.add_section('group fooers') + cfg.set('group fooers', 'members', 'jdoe') + cfg.set('group fooers', 'map writable foo/bar', 'baz/quux/thud') + eq(access.haveAccess( + config=cfg, user='jdoe', mode='writable', path='foo/bar'), + '/a/leading/path/baz/quux/thud') + +def test_base_global_relative(): + cfg = RawConfigParser() + cfg.add_section('gitosis') + cfg.set('gitosis', 'repositories', 'some/relative/path') + cfg.add_section('group fooers') + cfg.set('group fooers', 'members', 'jdoe') + cfg.set('group fooers', 'map writable foo/bar', 'baz/quux/thud') + eq(access.haveAccess( + config=cfg, user='jdoe', mode='writable', path='foo/bar'), + 'some/relative/path/baz/quux/thud') + +def test_base_global_relative_simple(): + cfg = RawConfigParser() + cfg.add_section('gitosis') + cfg.set('gitosis', 'repositories', 'some/relative/path') + cfg.add_section('group fooers') + cfg.set('group fooers', 'members', 'jdoe') + cfg.set('group fooers', 'readonly', 'foo xyzzy bar') + eq(access.haveAccess( + config=cfg, user='jdoe', mode='readonly', path='xyzzy'), + 'some/relative/path/xyzzy') + +def test_base_local(): + cfg = RawConfigParser() + cfg.add_section('group fooers') + cfg.set('group fooers', 'repositories', 'some/relative/path') + cfg.set('group fooers', 'members', 'jdoe') + cfg.set('group fooers', 'map writable foo/bar', 'baz/quux/thud') + eq(access.haveAccess( + config=cfg, user='jdoe', mode='writable', path='foo/bar'), + 'some/relative/path/baz/quux/thud') -- cgit v1.2.3