add delete functions for inbound and callback api objects

Both service api tasks work fine if the object is unexpectedly deleted
halfway through - they both check to see if the api details are still
in the DB before trying to send the request.
This commit is contained in:
Leo Hemsted
2018-07-05 11:09:17 +01:00
parent 4502dffa13
commit 32415b3b14
5 changed files with 155 additions and 74 deletions

View File

@@ -1106,7 +1106,7 @@ def admin_request(client):
url_for(endpoint, **(endpoint_kwargs or {})),
headers=[create_authorization_header()]
)
json_resp = json.loads(resp.get_data(as_text=True))
json_resp = resp.json
assert resp.status_code == _expected_status
return json_resp
@@ -1118,7 +1118,7 @@ def admin_request(client):
headers=[('Content-Type', 'application/json'), create_authorization_header()]
)
if resp.get_data():
json_resp = json.loads(resp.get_data(as_text=True))
json_resp = resp.json
else:
json_resp = None
assert resp.status_code == _expected_status
@@ -1130,7 +1130,10 @@ def admin_request(client):
url_for(endpoint, **(endpoint_kwargs or {})),
headers=[create_authorization_header()]
)
json_resp = json.loads(resp.get_data(as_text=True))
if resp.get_data():
json_resp = resp.json
else:
json_resp = None
assert resp.status_code == _expected_status, json_resp
return json_resp