def test_set_purpose_error(self, mock_requests): json_to_text = json.dumps(stubs.bad_set_purpose_response) mock_requests.post.return_value = Mock( status_code=500, text=json_to_text, ) sc = Slackest(token='aaa') error = sc.set_purpose('C0G9QF9GW', 'My purpose is entirely too long').body['error'] self.assertEqual('too_long', error)
def test_set_purpose(self, mock_requests): json_to_text = json.dumps(stubs.good_set_purpose_response) mock_requests.post.return_value = Mock( status_code=200, text=json_to_text, ) sc = Slackest(token='aaa') purpose = sc.set_purpose('C0G9QF9GW', 'My purpose').body['purpose'] self.assertEqual('My purpose', purpose)