示例#1
0
文件: ent_test.py 项目: vtapia/sssd
def test_assert_group_list(users_and_groups):
    ent.assert_group_list(ent.contains())
    ent.assert_group_list(ent.contains(GROUP1))
    ent.assert_group_list(ent.contains_only(*GROUP_LIST))
    try:
        ent.assert_group_list(ent.contains_only())
        assert False
    except AssertionError as e:
        assert not re.search("expected groups not found:", str(e))
        assert re.search("unexpected groups found:", str(e))
    try:
        ent.assert_group_list(ent.contains(dict(name="non_existent")))
        assert False
    except AssertionError as e:
        assert re.search("expected groups not found:", str(e))
        assert not re.search("unexpected groups found:", str(e))
示例#2
0
文件: ent_test.py 项目: SSSD/sssd
def test_assert_group_list(users_and_groups):
    ent.assert_group_list(ent.contains())
    ent.assert_group_list(ent.contains(GROUP1))
    ent.assert_group_list(ent.contains_only(*GROUP_LIST))
    try:
        ent.assert_group_list(ent.contains_only())
        assert False
    except AssertionError as e:
        assert not re.search("expected groups not found:", str(e))
        assert re.search("unexpected groups found:", str(e))
    try:
        ent.assert_group_list(ent.contains(dict(name="non_existent")))
        assert False
    except AssertionError as e:
        assert re.search("expected groups not found:", str(e))
        assert not re.search("unexpected groups found:", str(e))
示例#3
0
文件: ent_test.py 项目: abbra/sssd
    except AssertionError, e:
        assert str(e) == "'name' mismatch: 'group1' != 'group2'"


def test_assert_group_list(users_and_groups):
    ent.assert_group_list(ent.contains())
    ent.assert_group_list(ent.contains(GROUP1))
    ent.assert_group_list(ent.contains_only(*GROUP_LIST))
    try:
        ent.assert_group_list(ent.contains_only())
        assert False
    except AssertionError, e:
        assert not re.search("expected groups not found:", str(e))
        assert re.search("unexpected groups found:", str(e))
    try:
        ent.assert_group_list(ent.contains(dict(name="non_existent")))
        assert False
    except AssertionError, e:
        assert re.search("expected groups not found:", str(e))
        assert not re.search("unexpected groups found:", str(e))

def test_assert_each_group_by_name(users_and_groups):
    ent.assert_each_group_by_name({})
    ent.assert_each_group_by_name(dict(group1=GROUP1))
    ent.assert_each_group_by_name(GROUP_NAME_DICT)
    try:
        ent.assert_each_group_by_name(dict(group3={}))
        assert False
    except AssertionError, e:
        assert str(e) == "'getgrnam(): name not found: group3'"
    try:
示例#4
0
文件: ent_test.py 项目: spbnick/sssd
    except AssertionError, e:
        assert str(e) == "'name' mismatch: 'group1' != 'group2'"


def test_assert_group_list(users_and_groups):
    ent.assert_group_list(ent.contains())
    ent.assert_group_list(ent.contains(GROUP1))
    ent.assert_group_list(ent.contains_only(*GROUP_LIST))
    try:
        ent.assert_group_list(ent.contains_only())
        assert False
    except AssertionError, e:
        assert not re.search("expected groups not found:", str(e))
        assert re.search("unexpected groups found:", str(e))
    try:
        ent.assert_group_list(ent.contains(dict(name="non_existent")))
        assert False
    except AssertionError, e:
        assert re.search("expected groups not found:", str(e))
        assert not re.search("unexpected groups found:", str(e))


def test_assert_each_group_by_name(users_and_groups):
    ent.assert_each_group_by_name({})
    ent.assert_each_group_by_name(dict(group1=GROUP1))
    ent.assert_each_group_by_name(GROUP_NAME_DICT)
    try:
        ent.assert_each_group_by_name(dict(group3={}))
        assert False
    except AssertionError, e:
        assert str(e) == "'getgrnam(): name not found: group3'"