コード例 #1
0
ファイル: push_test.py プロジェクト: monetate/nd_okta_auth
    def test_push_rejected(self):
        push_factor = factor.PushFactor('https://foobar.okta.com')
        push_factor._request = mock.MagicMock(name='_request')

        push_factor._request.side_effect = [
            MFA_WAITING_RESPONSE,
            MFA_WAITING_RESPONSE,
            MFA_WAITING_RESPONSE,
            MFA_REJECTED_RESPONSE,
        ]

        with self.assertRaises(factor.FactorVerificationFailed):
            push_factor.verify('123', 'token', 0.1)
コード例 #2
0
ファイル: push_test.py プロジェクト: monetate/nd_okta_auth
    def test_push_success(self):
        push_factor = factor.PushFactor('https://foobar.okta.com')
        push_factor._request = mock.MagicMock(name='_request')

        push_factor._request.side_effect = [
            MFA_WAITING_RESPONSE,
            MFA_WAITING_RESPONSE,
            MFA_WAITING_RESPONSE,
            SUCCESS_RESPONSE,
        ]

        ret = push_factor.verify('123', 'token', 0.1)
        self.assertEqual(ret, SUCCESS_RESPONSE)
コード例 #3
0
ファイル: push_test.py プロジェクト: Nextdoor/nd_okta_auth
    def test_push_unknown_failure(self):
        push_factor = factor.PushFactor("https://foobar.okta.com")
        push_factor.get_passcode = mock.MagicMock(name="get_passcode")
        push_factor.get_passcode.return_value = 123456

        push_factor._request = mock.MagicMock(name="_request")

        resp = requests.Response()
        resp.status_code = 500
        resp.body = "Internal Server Error"
        push_factor._request.side_effect = requests.exceptions.HTTPError(response=resp)

        with self.assertRaises(requests.exceptions.HTTPError):
            push_factor.verify("123", "token", 0.1)
コード例 #4
0
ファイル: push_test.py プロジェクト: monetate/nd_okta_auth
 def test_push_name(self):
     push_factor = factor.PushFactor('foobar')
     self.assertEqual('push', push_factor.name())
コード例 #5
0
ファイル: push_test.py プロジェクト: Nextdoor/nd_okta_auth
 def test_push_name(self):
     push_factor = factor.PushFactor("foobar")
     self.assertEqual("push", push_factor.name())