def test_add_member_to_channel_error(self, mock_requests): json_to_text = json.dumps(stubs.bad_add_member_to_channel_response) mock_requests.post.return_value = Mock( status_code=200, text=json_to_text, ) sc = Slackest(token='aaa') error = sc.add_member_to_channel('C012AB3CD', 'U2345678901').body['error'] self.assertEqual('method_not_supported_for_channel_type', error)
def test_add_member_to_channel(self, mock_requests): json_to_text = json.dumps(stubs.good_add_member_to_channel_response) mock_requests.post.return_value = Mock( status_code=200, text=json_to_text, ) sc = Slackest(token='aaa') name = sc.add_member_to_channel('C012AB3CD', 'U2345678901').body['channel'].get('name') self.assertEqual('general', name)