diff --git a/zulip_bots/zulip_bots/bots/mention/fixtures/get_account_id.json b/zulip_bots/zulip_bots/bots/mention/fixtures/get_account_id.json new file mode 100644 index 0000000..5ef25ac --- /dev/null +++ b/zulip_bots/zulip_bots/bots/mention/fixtures/get_account_id.json @@ -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" + } +} diff --git a/zulip_bots/zulip_bots/bots/mention/test_mention.py b/zulip_bots/zulip_bots/bots/mention/test_mention.py index 3e0d238..d4e6fb7 100644 --- a/zulip_bots/zulip_bots/bots/mention/test_mention.py +++ b/zulip_bots/zulip_bots/bots/mention/test_mention.py @@ -1,3 +1,4 @@ +from zulip_bots.bots.mention.mention import MentionHandler from zulip_bots.test_lib import BotTestCase class TestMentionBot(BotTestCase): @@ -14,3 +15,10 @@ class TestMentionBot(BotTestCase): of the given keyword throughout the web. 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')