Ejemplo n.º 1
0
 def test_post_message_to_channel_error(self, mock_requests):
     json_to_text = json.dumps(stubs.bad_conversation_history_response)
     mock_requests.post.return_value = Mock(
         status_code=500, text=json_to_text,
     )
     sc = Slackest(token='aaa')
     error = sc.post_message_to_channel('slimer', "Here's a message for you").body['error']
     self.assertEqual('channel_not_found', error)
Ejemplo n.º 2
0
 def test_post_message_to_channel(self, mock_requests):
     json_to_text = json.dumps(stubs.good_conversation_history_response)
     mock_requests.post.return_value = Mock(
         status_code=200, text=json_to_text,
     )
     sc = Slackest(token='aaa')
     message_user = sc.post_message_to_channel('slimer', "Here's a message for you").body['messages'][0].get('user')
     self.assertEqual('U012AB3CDE', message_user)