コード例 #1
0
ファイル: decide_recipients.py プロジェクト: tv42/sekrit
def decide_recipients(cfg, path):
    sect = get_config(cfg, path)
    if sect is None:
        return []
    users = sect.get('users', '')
    users = users.split(None)
    return expand_groups(cfg, users)
コード例 #2
0
ファイル: test_groups.py プロジェクト: tv42/sekrit
def test_recursive_self():
    cfg = ConfigParser.RawConfigParser()
    cfg.readfp(StringIO("""\
[group bar]
users = foo @bar
"""))
    got = groups.expand_groups(cfg, ['@bar'])
    eq(sorted(got), sorted(['foo']))
コード例 #3
0
ファイル: test_groups.py プロジェクト: tv42/sekrit
def test_simple():
    cfg = ConfigParser.RawConfigParser()
    cfg.readfp(StringIO("""\
[group bar]
users = quux thud
"""))
    got = groups.expand_groups(cfg, ['foo', '@bar'])
    eq(sorted(got), sorted(['foo', 'quux', 'thud']))
コード例 #4
0
ファイル: test_groups.py プロジェクト: tv42/sekrit
def test_recursive():
    cfg = ConfigParser.RawConfigParser()
    cfg.readfp(StringIO("""\
[group first]
users = @second @third

[group second]
users = foo

[group third]
users = bar @first
"""))
    got = groups.expand_groups(cfg, ['@first'])
    eq(sorted(got), sorted(['foo', 'bar']))
コード例 #5
0
ファイル: test_groups.py プロジェクト: tv42/sekrit
def test_non_group():
    cfg = None
    got = groups.expand_groups(cfg, ['foo'])
    eq(sorted(got), sorted(['foo']))