Ejemplo n.º 1
0
def test_process_mfa_verification_1():
    parsed = {
        "_embedded": {
            "factors": [{
                "factorType": "unsupported",
                "_links": {
                    "verify": {
                        "href": "href"
                    }
                }
            }, {
                "factorType": "unsupported"
            }]
        },
        "stateToken": "statetoken"
    }
    authenticator = OktaAuthenticator(None)
    with mock.patch("awsprocesscreds.saml.OktaAuthenticator.get_mfa_choice",
                    return_value=1):
        with pytest.raises(SAMLError):
            authenticator.process_mfa_verification("endpoint", parsed)
Ejemplo n.º 2
0
def test_process_mfa_verification_5():
    parsed = {
        "_embedded": {
            "factors": [{
                "factorType": "sms",
                "_links": {
                    "verify": {
                        "href": "href"
                    }
                }
            }]
        },
        "stateToken": "statetoken"
    }
    authenticator = OktaAuthenticator(None)
    with mock.patch("awsprocesscreds.saml.OktaAuthenticator.process_mfa_sms",
                    return_value="mock_call"):
        result = authenticator.process_mfa_verification("endpoint", parsed)
        assert result == "mock_call"