{"action":"created","issue":{"url":"https://api.github.com/repos/zulip/zulip/issues/5334","repository_url":"https://api.github.com/repos/zulip/zulip","labels_url":"https://api.github.com/repos/zulip/zulip/issues/5334/labels{/name}","comments_url":"https://api.github.com/repos/zulip/zulip/issues/5334/comments","events_url":"https://api.github.com/repos/zulip/zulip/issues/5334/events","html_url":"https://github.com/zulip/zulip/pull/5334","id":235017098,"number":5334,"title":"bots: Add a way to mock config files.","user":{"login":"derAnfaenger","id":7950151,"avatar_url":"https://avatars1.githubusercontent.com/u/7950151?v=3","gravatar_id":"","url":"https://api.github.com/users/derAnfaenger","html_url":"https://github.com/derAnfaenger","followers_url":"https://api.github.com/users/derAnfaenger/followers","following_url":"https://api.github.com/users/derAnfaenger/following{/other_user}","gists_url":"https://api.github.com/users/derAnfaenger/gists{/gist_id}","starred_url":"https://api.github.com/users/derAnfaenger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derAnfaenger/subscriptions","organizations_url":"https://api.github.com/users/derAnfaenger/orgs","repos_url":"https://api.github.com/users/derAnfaenger/repos","events_url":"https://api.github.com/users/derAnfaenger/events{/privacy}","received_events_url":"https://api.github.com/users/derAnfaenger/received_events","type":"User","site_admin":false},"labels":[{"id":561830290,"url":"https://api.github.com/repos/zulip/zulip/labels/needs%20review","name":"needs review","color":"fef2c0","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-06-10T17:49:22Z","updated_at":"2017-06-13T18:23:17Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/zulip/zulip/pulls/5334","html_url":"https://github.com/zulip/zulip/pull/5334","diff_url":"https://github.com/zulip/zulip/pull/5334.diff","patch_url":"https://github.com/zulip/zulip/pull/5334.patch"},"body":"This got bigger than I expected, due to the amount of refactoring involved:\r\n\r\nHere's what I did to accomplish the title's claim in detail:\r\n\r\n1. Add an `initialize(client)` function bots can implement. This will get called on the initialization of the bot, so it doesn't have to wait for a message to be sent to retrieve the `BotHandlerApi` object.\r\n\r\n2. Add the `get_config_info` function to `BotHandlerApi`, retrieves config info in an `ini` file and stores it in a dict. Straightforward.\r\n\r\n3. Refactor `bot_test_lib.py` to initialize `MockClass` and `message_handler` only once per test method. This saves execution time, makes the code easier in general and also enables me to easily...\r\n\r\n4. ...mock `get_config_info` as a context manager."},"comment":{"url":"https://api.github.com/repos/zulip/zulip/issues/comments/308205159","html_url":"https://github.com/zulip/zulip/pull/5334#issuecomment-308205159","issue_url":"https://api.github.com/repos/zulip/zulip/issues/5334","id":308205159,"user":{"login":"timabbott","id":2746074,"avatar_url":"https://avatars3.githubusercontent.com/u/2746074?v=3","gravatar_id":"","url":"https://api.github.com/users/timabbott","html_url":"https://github.com/timabbott","followers_url":"https://api.github.com/users/timabbott/followers","following_url":"https://api.github.com/users/timabbott/following{/other_user}","gists_url":"https://api.github.com/users/timabbott/gists{/gist_id}","starred_url":"https://api.github.com/users/timabbott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timabbott/subscriptions","organizations_url":"https://api.github.com/users/timabbott/orgs","repos_url":"https://api.github.com/users/timabbott/repos","events_url":"https://api.github.com/users/timabbott/events{/privacy}","received_events_url":"https://api.github.com/users/timabbott/received_events","type":"User","site_admin":false},"created_at":"2017-06-13T18:23:17Z","updated_at":"2017-06-13T18:23:17Z","body":"Actually it looks like that test is failing already for me (may be a path issue).  I merged your big first commit to help head off merge conflicts."}}
{"actor":{"display_login":"timabbott"}}