def test_exchange_failure_with_json_error(self):
# Some providers have 'error' attribute as a JSON object
# in place of regular string.
# This test makes sure no strange object-to-string coversion
# exceptions are being raised instead of FlowExchangeError.
payload = (b'{'
b' "error": {'
b' "message": "Error validating verification code.",'
b' "type": "OAuthException"'
b' }'
b'}')
http = http_mock.HttpMock(data=payload)
with self.assertRaises(client.FlowExchangeError):
self.flow.step2_exchange(code='some random code', http=http)
评论列表
文章目录