def test_list_map(): cfg = RawConfigParser() cfg.add_section('group fooers') cfg.set('group fooers', 'members', 'jdoe') cfg.set('group fooers', 'map writable foo/bar', 'baz/quux/thud') cfg.add_section('group mooers') cfg.set('group mooers', 'readonly', 'baz/quux/thud') table = access.getAccessTable(cfg) users = set() groups = set() access.listAccess(cfg,table,'writable','baz/quux/thud',users,groups) eq(sorted(groups), ['fooers']) eq(sorted(users), [])
def test_list_read(): cfg = RawConfigParser() cfg.add_section('gitosis') cfg.set('gitosis', 'owner-readonly', 'yes') cfg.add_section('group fooers') cfg.set('group fooers', 'members', 'jdoe') cfg.set('group fooers', 'map writable foo/bar', 'baz/quux/thud') cfg.add_section('group mooers') cfg.set('group mooers', 'readonly', 'baz/quux/thud') cfg.add_section('user jdoe') cfg.set('user jdoe', 'readonly', 'baz/quux/thud') cfg.add_section('user master') cfg.add_section('user admin') cfg.set('user admin', 'allow-read-all', 'yes') cfg.add_section('repo baz/quux/thud') cfg.set('repo baz/quux/thud', 'owner', 'master') table = access.getAccessTable(cfg) users = set() groups = set() access.listAccess(cfg,table,'readonly','baz/quux/thud',users,groups) eq(sorted(groups), ['mooers']) eq(sorted(users), ['admin','jdoe','master'])