Beispiel #1
0
    def test_token_needs_refresh_fault_other(self):
        retry_state = tenacity.RetryCallState(None, None, None, None)
        retry_state.outcome = Mock()
        retry_state.outcome.exception = Mock(
            return_value=zeep.exceptions.Fault('message'))

        self.assertFalse(_token_needs_refresh(retry_state))
Beispiel #2
0
    def test_token_needs_refresh_validation_error_other(self):
        retry_state = tenacity.RetryCallState(None, None, None, None)
        retry_state.outcome = Mock()
        retry_state.outcome.exception = Mock(
            return_value=zeep.exceptions.ValidationError())

        self.assertFalse(_token_needs_refresh(retry_state))
Beispiel #3
0
    def test_token_needs_refresh_validation_error_session_handle(self):
        retry_state = tenacity.RetryCallState(None, None, None, None)
        retry_state.outcome = Mock()
        retry_state.outcome.exception = Mock(
            return_value=zeep.exceptions.ValidationError(
                message='Missing element sessionHandle'))

        self.assertTrue(_token_needs_refresh(retry_state))
Beispiel #4
0
    def test_token_needs_refresh_fault_invalid_token(self):
        retry_state = tenacity.RetryCallState(None, None, None, None)
        retry_state.outcome = Mock()
        retry_state.outcome.exception = Mock(
            return_value=zeep.exceptions.Fault(
                'message', code='ERR_INVALID_ACCESS_TOKEN'))

        self.assertTrue(_token_needs_refresh(retry_state))
Beispiel #5
0
    def test_token_needs_refresh_fault_no_session(self):
        retry_state = tenacity.RetryCallState(None, None, None, None)
        retry_state.outcome = Mock()
        retry_state.outcome.exception = Mock(
            return_value=zeep.exceptions.Fault('message',
                                               code='ERR_NO_SESSION'))

        self.assertTrue(_token_needs_refresh(retry_state))
Beispiel #6
0
    def test_token_needs_refresh_conn_aborted(self):
        retry_state = tenacity.RetryCallState(None, None, None, None)
        retry_state.outcome = Mock()
        retry_state.outcome.exception = Mock(
            return_value=requests.exceptions.ConnectionError(
                Exception('Connection aborted.')))

        self.assertTrue(_token_needs_refresh(retry_state))
Beispiel #7
0
    def test_token_needs_refresh_success(self):
        retry_state = tenacity.RetryCallState(None, None, None, None)
        retry_state.outcome = Mock()

        self.assertFalse(_token_needs_refresh(retry_state))