Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def success_assertions(self, r):
"""
Assertions for every command that should complete successfully.
"""
assert r.status_code == tm.status_codes.ok, 'message from server: "{}"'.format(r.status_message)
assert r.status_message != None
assert r.status_message
r.raise_for_status()
def ok(self):
"""
:return: True if the request completed with no errors.
For this property to return True:
- The HTTP request must return a status code of ``200 OK``
- The first line of the response from the Tomcat Server must begin with ``OK``.
"""
return all([
self.response != None,
self.response.status_code == requests.codes.ok,
self.status_code == tm.status_codes.ok,
])