Beispiel #1
0
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)
Beispiel #2
0
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']))
Beispiel #3
0
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']))
Beispiel #4
0
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']))
Beispiel #5
0
def test_non_group():
    cfg = None
    got = groups.expand_groups(cfg, ['foo'])
    eq(sorted(got), sorted(['foo']))