def test_notify_recipient(self, slack_client, get_name, get_octocat): """ Full integration test. """ slack_client.return_value = {'ok': False, 'error': 'not_authed'} get_name.return_value = FULL_NAME get_octocat.return_value = 'octocat' with self.assertLogs('app.slack', level='WARNING'): slack.notify_recipient(SAMPLE_GITHUB_PAYLOAD)
def pull_request(data, _guid): """ Handle a pull request webhook and notify the reviewer on slack. This will validate the request making sure it is an action that is written to be handled, then will kick off apropriate actions for the hook such as sending slack notifications to the requested reviewer. """ if is_valid_pull_request(data): notify_recipient(data) result = 'Recipient Notified' else: result = 'Action ({}) ignored'.format(data.get('action')) return result
def test_notify_recipient_on_network(self): """ Full integration test on the network. """ with self.assertLogs('app.slack', level='INFO'): slack.notify_recipient({})