def test_get_conversation_history_error(self, mock_requests): json_to_text = json.dumps(stubs.bad_conversation_history_response) mock_requests.get.return_value = Mock( status_code=404, text=json_to_text, ) sc = Slackest(token='aaa') sc_gen = next(sc.history_all('NOTFOUND')) error = sc_gen.body['error'] self.assertEqual('channel_not_found', error)
def test_get_conversation_history(self, mock_requests): json_to_text = json.dumps(stubs.good_conversation_history_response) mock_requests.get.return_value = Mock( status_code=200, text=json_to_text, ) sc = Slackest(token='aaa') sc_gen = next(sc.history_all('asd')) second_user = sc_gen.body['messages'][1].get('user') self.assertEqual('U061F7AUR', second_user)