def test_get_channel_info_error(self, mock_requests): json_to_text = json.dumps(stubs.bad_channel_info_response) mock_requests.get.return_value = Mock( status_code=404, text=json_to_text, ) sc = Slackest(token='aaa') error = sc.get_channel_info('NOTFOUND').body['error'] self.assertEqual('channel_not_found', error)
def test_get_channel_info(self, mock_requests): json_to_text = json.dumps(stubs.good_channel_info_response) mock_requests.get.return_value = Mock( status_code=200, text=json_to_text, ) sc = Slackest(token='aaa') channel_name = sc.get_channel_info('C0G9QF9GW').body['channel'].get('name') self.assertEqual('busting', channel_name)