Example #1
0
def test_assert_each_passwd_with_uid(users_and_groups):
    ent.assert_each_passwd_with_uid([])
    ent.assert_each_passwd_with_uid([USER1])
    ent.assert_each_passwd_with_uid(USER_LIST)
    try:
        ent.assert_each_passwd_with_uid([dict(uid=1003)])
        assert False
    except AssertionError as e:
        assert str(e) == "'getpwuid(): uid not found: 1003'"
    try:
        ent.assert_each_passwd_with_uid([dict(name="user2", uid=1001)])
        assert False
    except AssertionError as e:
        assert str(e) == \
            "user 1001 mismatch: 'name' mismatch: 'user2' != 'user1'"
Example #2
0
def test_assert_each_passwd_with_uid(users_and_groups):
    ent.assert_each_passwd_with_uid([])
    ent.assert_each_passwd_with_uid([USER1])
    ent.assert_each_passwd_with_uid(USER_LIST)
    try:
        ent.assert_each_passwd_with_uid([dict(uid=1003)])
        assert False
    except AssertionError as e:
        assert str(e) == "'getpwuid(): uid not found: 1003'"
    try:
        ent.assert_each_passwd_with_uid([dict(name="user2", uid=1001)])
        assert False
    except AssertionError as e:
        assert str(e) == \
            "user 1001 mismatch: 'name' mismatch: 'user2' != 'user1'"
Example #3
0
def test_assert_each_passwd_with_uid(users_and_groups):
    ent.assert_each_passwd_with_uid([])
    ent.assert_each_passwd_with_uid([USER1])
    ent.assert_each_passwd_with_uid(USER_LIST)
    try:
        ent.assert_each_passwd_with_uid([dict(uid=1003)])
        assert False
    except AssertionError, e:
        assert str(e) == "'getpwuid(): uid not found: 1003'"
Example #4
0
def test_assert_each_passwd_with_uid(users_and_groups):
    ent.assert_each_passwd_with_uid([])
    ent.assert_each_passwd_with_uid([USER1])
    ent.assert_each_passwd_with_uid(USER_LIST)
    try:
        ent.assert_each_passwd_with_uid([dict(uid=1003)])
        assert False
    except AssertionError, e:
        assert str(e) == "'getpwuid(): uid not found: 1003'"
Example #5
0
        assert False
    except AssertionError, e:
        assert str(e) == \
               "user 'user1' mismatch: 'uid' mismatch: 1002 != 1001"

def test_assert_each_passwd_with_uid(users_and_groups):
    ent.assert_each_passwd_with_uid([])
    ent.assert_each_passwd_with_uid([USER1])
    ent.assert_each_passwd_with_uid(USER_LIST)
    try:
        ent.assert_each_passwd_with_uid([dict(uid=1003)])
        assert False
    except AssertionError, e:
        assert str(e) == "'getpwuid(): uid not found: 1003'"
    try:
        ent.assert_each_passwd_with_uid([dict(name="user2", uid=1001)])
        assert False
    except AssertionError, e:
        assert str(e) == \
               "user 1001 mismatch: 'name' mismatch: 'user2' != 'user1'"

def test_assert_passwd(users_and_groups):
    ent.assert_passwd(ent.contains())
    ent.assert_passwd(ent.contains(USER1))
    ent.assert_passwd(ent.contains_only(*USER_LIST))
    try:
        ent.assert_passwd(ent.contains(dict(name="user3", uid=1003)))
        assert False
    except AssertionError, e:
        assert re.search("list mismatch:", str(e))
        assert re.search("expected users not found:", str(e))
Example #6
0
    except AssertionError, e:
        assert str(e) == \
               "user 'user1' mismatch: 'uid' mismatch: 1002 != 1001"


def test_assert_each_passwd_with_uid(users_and_groups):
    ent.assert_each_passwd_with_uid([])
    ent.assert_each_passwd_with_uid([USER1])
    ent.assert_each_passwd_with_uid(USER_LIST)
    try:
        ent.assert_each_passwd_with_uid([dict(uid=1003)])
        assert False
    except AssertionError, e:
        assert str(e) == "'getpwuid(): uid not found: 1003'"
    try:
        ent.assert_each_passwd_with_uid([dict(name="user2", uid=1001)])
        assert False
    except AssertionError, e:
        assert str(e) == \
               "user 1001 mismatch: 'name' mismatch: 'user2' != 'user1'"


def test_assert_passwd(users_and_groups):
    ent.assert_passwd(ent.contains())
    ent.assert_passwd(ent.contains(USER1))
    ent.assert_passwd(ent.contains_only(*USER_LIST))
    try:
        ent.assert_passwd(ent.contains(dict(name="user3", uid=1003)))
        assert False
    except AssertionError, e:
        assert re.search("list mismatch:", str(e))