def test_post_thread_to_message_error(self, mock_requests): json_to_text = json.dumps(stubs.bad_post_thread_to_message_response) mock_requests.post.return_value = Mock( status_code=200, text=json_to_text, ) sc = Slackest(token='aaa') error = sc.post_thread_to_message('slimer', "Here's a message for you", '1503435956.000247').body['error'] self.assertEqual('is_archived', error)
def test_post_thread_to_message(self, mock_requests): json_to_text = json.dumps(stubs.good_post_thread_to_message_response) mock_requests.post.return_value = Mock( status_code=200, text=json_to_text, ) sc = Slackest(token='aaa') username = sc.post_thread_to_message('slimer', "Here's a message for you", '1503435956.000247').body['message'].get('username') self.assertEqual('ecto1', username)