zulip_bots: Add test for get_account_id method of Mention bot.

This commit is contained in:
Viraat Chandra 2017-12-29 21:57:34 +05:30 committed by showell
parent 67b3529140
commit 4d3e255e6d
2 changed files with 65 additions and 0 deletions

View file

@ -0,0 +1,57 @@
{
"request": {
"api_url": "https://api.mention.net/api/accounts/me",
"headers": {
"Authorization": "Bearer TEST",
"Accept-Version": "1.15"
}
},
"response": {
"account": {
"id": "TEST",
"name": "John Smith",
"email": "j.smith@nasa.com",
"language_code": "en",
"created_at": "2016-01-18T14:49:37.0+00:00",
"updated_at": "2016-01-18T14:49:37.0+00:00",
"grouped_email_notification": false,
"default_email_notification_frequency": "daily",
"default_desktop_notification_frequency": "hourly",
"default_push_notification_frequency": "hourly",
"default_trending_email_notification_frequency": "occasionally",
"permissions": {
"create_alert": true,
"read_teammembers": true,
"read_teamrequests": true,
"read_quotastats": true
},
"email_subscriptions": {
"quota_exceeded": true
}
},
"_links": {
"self": {
"href": "\/api\/accounts\/630929_4wgkw0o0go4wco40wos4gww44tbrsluiajok04g4gsscw8wssk"
}
}
},
"response-headers": {
"X-XSS-Protection": "1; mode=block",
"X-Upstream2": "mention_backend",
"X-Content-Type-Options": "nosniff",
"X-Protected-By": "Sqreen",
"Transfer-Encoding": "chunked",
"X-Api-Version": "1.15",
"Content-Encoding": "gzip",
"Connection": "keep-alive",
"Server": "nginx",
"Content-Type": "application/json",
"Vary": "Accept-Encoding, Accept-Language, X-Accept-Language",
"Set-Cookie": "www_bucket=55; Expires=Tue, 30 Jan 2018 10:59:52 GMT; Domain=mention.com; Path=/",
"Date": "Sun, 31 Dec 2017 10:59:52 GMT",
"X-Frame-Options": "SAMEORIGIN",
"Cache-Control": "no-cache, private",
"Referrer-Policy": "same-origin",
"X-S": "web16"
}
}

View file

@ -1,3 +1,4 @@
from zulip_bots.bots.mention.mention import MentionHandler
from zulip_bots.test_lib import BotTestCase from zulip_bots.test_lib import BotTestCase
class TestMentionBot(BotTestCase): class TestMentionBot(BotTestCase):
@ -14,3 +15,10 @@ class TestMentionBot(BotTestCase):
of the given keyword throughout the web. of the given keyword throughout the web.
Version 1.00 Version 1.00
''') ''')
def test_get_account_id(self) -> None:
bot_test_instance = MentionHandler()
bot_test_instance.access_token = 'TEST'
with self.mock_http_conversation('get_account_id'):
self.assertEqual(bot_test_instance.get_account_id(), 'TEST')