def test_kick_user_error(self, mock_requests): json_to_text = json.dumps(stubs.bad_kick_user_response) mock_requests.post.return_value = Mock( status_code=500, text=json_to_text, ) sc = Slackest(token='aaa') error = sc.kick_user('C0G9QF9GW', 'U0G9QF9C6').body['error'] self.assertEqual('user_not_found', error)
def test_kick_user(self, mock_requests): json_to_text = json.dumps(stubs.good_kick_user_response) mock_requests.post.return_value = Mock( status_code=200, text=json_to_text, ) sc = Slackest(token='aaa') ku = sc.kick_user('C0G9QF9GW', 'U0G9QF9C6').body['ok'] self.assertEqual('true', ku)