示例#1
0
def test_some_groups3_uid(some_groups3):
    """Test "some" scope with group list and getpwuid"""
    ent.assert_each_passwd_by_uid({
        1001: dict(name="user1", uid=1001, shell="/bin/sh1"),
        1002: dict(name="user2", uid=1002, shell="/bin/sh2"),
        1003: dict(name="user3", uid=1003, shell="/bin/sh3"),
        1004: dict(name="user4", uid=1004,
                   shell=config.SESSION_RECORDING_SHELL),
    })
示例#2
0
def test_some_groups_overridden4_uid(some_groups_overridden3):
    """
    Test "some" scope with group list containing some
    overridden group, and users requested with getpwuid.
    """
    ent.assert_each_passwd_by_uid({
        1001: dict(name="user1", uid=1001,
                   shell=config.SESSION_RECORDING_SHELL),
        1002: dict(name="user2", uid=1002, shell="/bin/sh2"),
        1003: dict(name="user3", uid=1003, shell="/bin/sh3"),
        1004: dict(name="user4", uid=1004, shell="/bin/sh4"),
    })
示例#3
0
def test_all_uid(all):
    """Test "all" scope with getpwuid"""
    ent.assert_each_passwd_by_uid({
        1001: dict(name="user1", uid=1001,
                   shell=config.SESSION_RECORDING_SHELL),
        1002: dict(name="user2", uid=1002,
                   shell=config.SESSION_RECORDING_SHELL),
        1003: dict(name="user3", uid=1003,
                   shell=config.SESSION_RECORDING_SHELL),
        1004: dict(name="user4", uid=1004,
                   shell=config.SESSION_RECORDING_SHELL),
    })
示例#4
0
def test_some_groups4_uid(some_groups4):
    """Test "some" scope with group list and getpwuid"""
    ent.assert_each_passwd_by_uid({
        1001:
        dict(name="user1", uid=1001, shell=config.SESSION_RECORDING_SHELL),
        1002:
        dict(name="user2", uid=1002, shell="/bin/sh2"),
        1003:
        dict(name="user3", uid=1003, shell=config.SESSION_RECORDING_SHELL),
        1004:
        dict(name="user4", uid=1004, shell="/bin/sh4"),
    })
示例#5
0
def test_all_uid(all):
    """Test "all" scope with getpwuid"""
    ent.assert_each_passwd_by_uid({
        1001:
        dict(name="user1", uid=1001, shell=config.SESSION_RECORDING_SHELL),
        1002:
        dict(name="user2", uid=1002, shell=config.SESSION_RECORDING_SHELL),
        1003:
        dict(name="user3", uid=1003, shell=config.SESSION_RECORDING_SHELL),
        1004:
        dict(name="user4", uid=1004, shell=config.SESSION_RECORDING_SHELL),
    })
示例#6
0
def test_all_exclude_groups_uid(all_exclude_groups):
    """Test "all" scope with group list and getpwuid"""
    ent.assert_each_passwd_by_uid({
        1001:
        dict(name="user1", uid=1001, shell="/bin/sh1"),
        1002:
        dict(name="user2", uid=1002, shell="/bin/sh2"),
        1003:
        dict(name="user3", uid=1003, shell="/bin/sh3"),
        1004:
        dict(name="user4", uid=1004, shell=config.SESSION_RECORDING_SHELL),
    })
示例#7
0
文件: ent_test.py 项目: vtapia/sssd
def test_assert_each_passwd_by_uid(users_and_groups):
    ent.assert_each_passwd_by_uid({})
    ent.assert_each_passwd_by_uid({1001: USER1})
    ent.assert_each_passwd_by_uid(USER_UID_DICT)
    try:
        ent.assert_each_passwd_by_uid({1003: {}})
        assert False
    except AssertionError as e:
        assert str(e) == "'getpwuid(): uid not found: 1003'"
    try:
        ent.assert_each_passwd_by_uid({1001: dict(uid=1002)})
        assert False
    except AssertionError as e:
        assert str(e) == \
            "user 1001 mismatch: 'uid' mismatch: 1002 != 1001"
示例#8
0
文件: ent_test.py 项目: SSSD/sssd
def test_assert_each_passwd_by_uid(users_and_groups):
    ent.assert_each_passwd_by_uid({})
    ent.assert_each_passwd_by_uid({1001: USER1})
    ent.assert_each_passwd_by_uid(USER_UID_DICT)
    try:
        ent.assert_each_passwd_by_uid({1003: {}})
        assert False
    except AssertionError as e:
        assert str(e) == "'getpwuid(): uid not found: 1003'"
    try:
        ent.assert_each_passwd_by_uid({1001: dict(uid=1002)})
        assert False
    except AssertionError as e:
        assert str(e) == \
            "user 1001 mismatch: 'uid' mismatch: 1002 != 1001"
示例#9
0
def test_some_groups_overridden4_uid(some_groups_overridden3):
    """
    Test "some" scope with group list containing some
    overridden group, and users requested with getpwuid.
    """
    ent.assert_each_passwd_by_uid({
        1001:
        dict(name="user1", uid=1001, shell=config.SESSION_RECORDING_SHELL),
        1002:
        dict(name="user2", uid=1002, shell="/bin/sh2"),
        1003:
        dict(name="user3", uid=1003, shell="/bin/sh3"),
        1004:
        dict(name="user4", uid=1004, shell="/bin/sh4"),
    })
示例#10
0
文件: ent_test.py 项目: abbra/sssd
def test_assert_each_passwd_by_uid(users_and_groups):
    ent.assert_each_passwd_by_uid({})
    ent.assert_each_passwd_by_uid({1001:USER1})
    ent.assert_each_passwd_by_uid(USER_UID_DICT)
    try:
        ent.assert_each_passwd_by_uid({1003:{}})
        assert False
    except AssertionError, e:
        assert str(e) == "'getpwuid(): uid not found: 1003'"
示例#11
0
文件: ent_test.py 项目: spbnick/sssd
def test_assert_each_passwd_by_uid(users_and_groups):
    ent.assert_each_passwd_by_uid({})
    ent.assert_each_passwd_by_uid({1001: USER1})
    ent.assert_each_passwd_by_uid(USER_UID_DICT)
    try:
        ent.assert_each_passwd_by_uid({1003: {}})
        assert False
    except AssertionError, e:
        assert str(e) == "'getpwuid(): uid not found: 1003'"
示例#12
0
文件: ent_test.py 项目: abbra/sssd
        assert False
    except AssertionError, e:
        assert str(e) == \
               "user 'user1' mismatch: 'name' mismatch: 'user2' != 'user1'"

def test_assert_each_passwd_by_uid(users_and_groups):
    ent.assert_each_passwd_by_uid({})
    ent.assert_each_passwd_by_uid({1001:USER1})
    ent.assert_each_passwd_by_uid(USER_UID_DICT)
    try:
        ent.assert_each_passwd_by_uid({1003:{}})
        assert False
    except AssertionError, e:
        assert str(e) == "'getpwuid(): uid not found: 1003'"
    try:
        ent.assert_each_passwd_by_uid({1001:dict(uid=1002)})
        assert False
    except AssertionError, e:
        assert str(e) == \
               "user 1001 mismatch: 'uid' mismatch: 1002 != 1001"

def test_assert_each_passwd_with_name(users_and_groups):
    ent.assert_each_passwd_with_name([])
    ent.assert_each_passwd_with_name([USER1])
    ent.assert_each_passwd_with_name(USER_LIST)
    try:
        ent.assert_each_passwd_with_name([dict(name="user3")])
        assert False
    except AssertionError, e:
        assert str(e) == "'getpwnam(): name not found: user3'"
    try:
示例#13
0
文件: ent_test.py 项目: spbnick/sssd
    except AssertionError, e:
        assert str(e) == \
               "user 'user1' mismatch: 'name' mismatch: 'user2' != 'user1'"


def test_assert_each_passwd_by_uid(users_and_groups):
    ent.assert_each_passwd_by_uid({})
    ent.assert_each_passwd_by_uid({1001: USER1})
    ent.assert_each_passwd_by_uid(USER_UID_DICT)
    try:
        ent.assert_each_passwd_by_uid({1003: {}})
        assert False
    except AssertionError, e:
        assert str(e) == "'getpwuid(): uid not found: 1003'"
    try:
        ent.assert_each_passwd_by_uid({1001: dict(uid=1002)})
        assert False
    except AssertionError, e:
        assert str(e) == \
               "user 1001 mismatch: 'uid' mismatch: 1002 != 1001"


def test_assert_each_passwd_with_name(users_and_groups):
    ent.assert_each_passwd_with_name([])
    ent.assert_each_passwd_with_name([USER1])
    ent.assert_each_passwd_with_name(USER_LIST)
    try:
        ent.assert_each_passwd_with_name([dict(name="user3")])
        assert False
    except AssertionError, e:
        assert str(e) == "'getpwnam(): name not found: user3'"