예제 #1
0
파일: __init__.py 프로젝트: chevah/compat
def setup_package():
    # Don't run these tests if we can not access privileged OS part.
    if not runElevatedTest():
        raise CompatTestCase.skipTest()
    # Initialize the testing OS.

    try:
        setup_access_control(users=TEST_USERS, groups=TEST_GROUPS)
    except:
        import traceback

        print(traceback.format_exc())
        print("Failed to initialized the system accounts!")
        teardown_access_control(users=TEST_USERS, groups=TEST_GROUPS)
        raise
예제 #2
0
def setup_package():
    # Don't run these tests if we can not access privileged OS part.
    if not should_run_elevated_test():
        raise EmpiricalTestCase.skipTest()

    # Initialize the testing OS.
    try:
        setup_access_control(users=TEST_USERS, groups=TEST_GROUPS)
    except:  # pragma: no cover
        # Report some error if setup fails and rollback.
        import traceback
        error = traceback.format_exc()
        try:
            teardown_access_control(users=TEST_USERS, groups=TEST_GROUPS)
        except:
            pass
        raise AssertionError(
            'Failed to initialize system accounts.\n\n%s' % (error))
예제 #3
0
def setup_package():
    # Don't run these tests if we can not access privileged OS part.
    if not runDomainTest():
        raise ChevahTestCase.skipTest()

    # Initialize the testing OS.
    DOMAIN_USERS = {
        u'domain': TestUser(
            name=TEST_ACCOUNT_USERNAME_DOMAIN,
            password=TEST_ACCOUNT_PASSWORD_DOMAIN,
            domain=TEST_DOMAIN,
            pdc=TEST_PDC,
            create_local_profile=True,
            ),
        }

    DOMAIN_GROUPS = {
        u'domain': TestGroup(
            name=TEST_ACCOUNT_GROUP_DOMAIN,
            members=[TEST_ACCOUNT_USERNAME_DOMAIN],
            pdc=TEST_PDC,
            ),
        }

    TEST_USERS.update(DOMAIN_USERS)
    TEST_GROUPS.update(DOMAIN_GROUPS)

    try:
        setup_access_control(
            users=TEST_USERS, groups=TEST_GROUPS)
    except:
        import traceback
        print(traceback.format_exc())
        print("Failed to initialized the system accounts!")
        teardown_access_control(
            users=TEST_USERS, groups=TEST_GROUPS)
        raise