Пример #1
0
def test_assert_each_group_with_gid(users_and_groups):
    ent.assert_each_group_with_gid([])
    ent.assert_each_group_with_gid([GROUP1])
    ent.assert_each_group_with_gid(GROUP_LIST)
    try:
        ent.assert_each_group_with_gid([dict(gid=2003)])
        assert False
    except AssertionError as e:
        assert str(e) == "'getgrgid(): gid not found: 2003'"
    try:
        ent.assert_each_group_with_gid([dict(name="group2", gid=2001)])
        assert False
    except AssertionError as e:
        assert str(e) == \
            "group 2001 mismatch: 'name' mismatch: 'group2' != 'group1'"
Пример #2
0
def test_assert_each_group_with_gid(users_and_groups):
    ent.assert_each_group_with_gid([])
    ent.assert_each_group_with_gid([GROUP1])
    ent.assert_each_group_with_gid(GROUP_LIST)
    try:
        ent.assert_each_group_with_gid([dict(gid=2003)])
        assert False
    except AssertionError as e:
        assert str(e) == "'getgrgid(): gid not found: 2003'"
    try:
        ent.assert_each_group_with_gid([dict(name="group2", gid=2001)])
        assert False
    except AssertionError as e:
        assert str(e) == \
            "group 2001 mismatch: 'name' mismatch: 'group2' != 'group1'"
Пример #3
0
def test_assert_each_group_with_gid(users_and_groups):
    ent.assert_each_group_with_gid([])
    ent.assert_each_group_with_gid([GROUP1])
    ent.assert_each_group_with_gid(GROUP_LIST)
    try:
        ent.assert_each_group_with_gid([dict(gid=2003)])
        assert False
    except AssertionError, e:
        assert str(e) == "'getgrgid(): gid not found: 2003'"
Пример #4
0
def test_assert_each_group_with_gid(users_and_groups):
    ent.assert_each_group_with_gid([])
    ent.assert_each_group_with_gid([GROUP1])
    ent.assert_each_group_with_gid(GROUP_LIST)
    try:
        ent.assert_each_group_with_gid([dict(gid=2003)])
        assert False
    except AssertionError, e:
        assert str(e) == "'getgrgid(): gid not found: 2003'"
Пример #5
0
        assert False
    except AssertionError, e:
        assert str(e) == \
               "group 'group1' mismatch: 'gid' mismatch: 2002 != 2001"

def test_assert_each_group_with_gid(users_and_groups):
    ent.assert_each_group_with_gid([])
    ent.assert_each_group_with_gid([GROUP1])
    ent.assert_each_group_with_gid(GROUP_LIST)
    try:
        ent.assert_each_group_with_gid([dict(gid=2003)])
        assert False
    except AssertionError, e:
        assert str(e) == "'getgrgid(): gid not found: 2003'"
    try:
        ent.assert_each_group_with_gid([dict(name="group2", gid=2001)])
        assert False
    except AssertionError, e:
        assert str(e) == \
               "group 2001 mismatch: 'name' mismatch: 'group2' != 'group1'"

def test_assert_group(users_and_groups):
    ent.assert_group(ent.contains())
    ent.assert_group(ent.contains(GROUP1))
    ent.assert_group(ent.contains_only(*GROUP_LIST))
    try:
        ent.assert_group(ent.contains(dict(name="group3", gid=2003)))
        assert False
    except AssertionError, e:
        assert re.search("list mismatch:", str(e))
        assert re.search("expected groups not found:", str(e))
Пример #6
0
    except AssertionError, e:
        assert str(e) == \
               "group 'group1' mismatch: 'gid' mismatch: 2002 != 2001"


def test_assert_each_group_with_gid(users_and_groups):
    ent.assert_each_group_with_gid([])
    ent.assert_each_group_with_gid([GROUP1])
    ent.assert_each_group_with_gid(GROUP_LIST)
    try:
        ent.assert_each_group_with_gid([dict(gid=2003)])
        assert False
    except AssertionError, e:
        assert str(e) == "'getgrgid(): gid not found: 2003'"
    try:
        ent.assert_each_group_with_gid([dict(name="group2", gid=2001)])
        assert False
    except AssertionError, e:
        assert str(e) == \
               "group 2001 mismatch: 'name' mismatch: 'group2' != 'group1'"


def test_assert_group(users_and_groups):
    ent.assert_group(ent.contains())
    ent.assert_group(ent.contains(GROUP1))
    ent.assert_group(ent.contains_only(*GROUP_LIST))
    try:
        ent.assert_group(ent.contains(dict(name="group3", gid=2003)))
        assert False
    except AssertionError, e:
        assert re.search("list mismatch:", str(e))