Exemple #1
0
def dummy_user_with_otp(client, dummy_user):
    result = ipa_admin.otptoken_add(o_ipatokenowner="dummy",
                                    o_description="dummy's token")
    token = OTPToken(result["result"])
    yield token
    # Deletion needs to be done as admin to remove the last token
    ipa_admin.otptoken_del(token.uniqueid)
Exemple #2
0
def dummy_user_with_otp(client, logged_in_dummy_user):
    ipa = logged_in_dummy_user
    result = ipa.otptoken_add(o_ipatokenowner="dummy", o_description="dummy's token",)
    token = OTPToken(result['result'])
    yield token
    # Deletion needs to be done as admin to remove the last token
    try:
        ipa_admin.otptoken_del(token.uniqueid)
    except python_freeipa.exceptions.NotFound:
        pass  # Already deleted
Exemple #3
0
def dummy_user_with_2_otp(client, logged_in_dummy_user, dummy_user_with_otp):
    ipa = logged_in_dummy_user
    result = ipa.otptoken_add(
        o_ipatokenowner="dummy",
        o_description="dummy's other token",
    )['result']
    token = OTPToken(result)
    yield dummy_user_with_otp, token
    try:
        ipa_admin.otptoken_del(token.uniqueid)
    except python_freeipa.exceptions.NotFound:
        pass  # already deleted, it's fine.
Exemple #4
0
def cleanup_dummy_tokens():
    yield
    tokens = ipa_admin.otptoken_find(a_criteria="dummy")
    for token in [OTPToken(t) for t in tokens["result"]]:
        ipa_admin.otptoken_del(a_ipatokenuniqueid=token.uniqueid)