google_translate bot: Add test for invalid api key.
This commit is contained in:
parent
d11d31d795
commit
28120784ff
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"api_url": "https://translation.googleapis.com/language/translate/v2/languages",
|
||||
"params": {
|
||||
"key": "abcdefg",
|
||||
"target": "en"
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"error":{
|
||||
"status": "INVALID_ARGUMENT",
|
||||
"message": "API key not valid. Please pass a valid API key.",
|
||||
"code": 400,
|
||||
"errors": [
|
||||
{
|
||||
"domain":"global",
|
||||
"message":"API key not valid. Please pass a valid API key.",
|
||||
"reason":"badRequest"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"response-headers": {
|
||||
"status": 400,
|
||||
"content-type": "application/json; charset=utf-8"
|
||||
}
|
||||
}
|
|
@ -66,6 +66,10 @@ class TestGoogleTranslateBot(BotTestCase):
|
|||
side_effect=Exception):
|
||||
self._test('"hello" de', 'Error. .', 'test_languages')
|
||||
|
||||
def test_invalid_api_key(self):
|
||||
with self.assertRaises(StubBotHandler.BotQuitException):
|
||||
self._test(None, None, 'test_invalid_api_key')
|
||||
|
||||
def test_api_access_not_configured(self):
|
||||
with self.assertRaises(StubBotHandler.BotQuitException):
|
||||
self._test(None, None, 'test_api_access_not_configured')
|
||||
|
|
Loading…
Reference in a new issue