def test_dump_of_fetched_message(self, mock_request): # Fetch a bounce _response = self.response self.response = BounceTest.response mock_request.return_value = self.mock_response(self.json_response) r = pystmark.get_bounce(self.bounce_id, test=True) self.assertValidJSONResponse(r, BounceTest.schema) # Fetch the dump via the bounce object old_r = r self.response = _response mock_request.return_value = self.mock_response(self.json_response) r = old_r.bounce.dump(test=True) self.assertValidJSONResponse(r, self.response) # Fetch the dump via the bounce object, using the default sender self.response = _response mock_request.return_value = self.mock_response(self.json_response) old_r.bounce._sender = None r = old_r.bounce.dump(test=True) self.assertValidJSONResponse(r, self.response)
def test_bad_json_response(self, mock_request): mock_request.return_value = self.mock_response(self.json_response, bad_json=True) r = pystmark.get_bounce(self.bounce_id, test=True) self.assertIs(r.bounce, None)
def test_simple_api(self, mock_request): mock_request.return_value = self.mock_response(self.json_response) r = pystmark.get_bounce(self.bounce_id, test=True) self.assertValidJSONResponse(r, self.schema)
def test_get_bounce(self): r = pystmark.get_bounce(777, test=True) self.assert500(r)