def test_create_channel_error(self, mock_requests): json_to_text = json.dumps(stubs.bad_channel_info_response) mock_requests.post.return_value = Mock( status_code=404, text=json_to_text, ) sc = Slackest(token='aaa') error = sc.create_channel('busting', False, ["U0G9QF9C6", "U1QNSQB9U"]).body['error'] self.assertEqual('channel_not_found', error)
def test_create_channel(self, mock_requests): json_to_text = json.dumps(stubs.good_channel_info_response) mock_requests.post.return_value = Mock( status_code=200, text=json_to_text, ) sc = Slackest(token='aaa') new_channel_id = sc.create_channel('busting', False, ["U0G9QF9C6", "U1QNSQB9U"]).body['channel'].get('id') self.assertEqual('C1H9RESGL', new_channel_id)