Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions flapison/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def wrapper(*args, **kwargs):
except Exception as e:
if current_app.config["DEBUG"] is True:
raise e
current_app.log_exception(e)

if "sentry" in current_app.extensions:
current_app.extensions["sentry"].captureException()
Expand Down
10 changes: 8 additions & 2 deletions tests/test_content_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,10 @@ def test_accept_no_accept(person, person_2, client, registered_routes):
Check that a request without an Accept header works
"""
response = client.get(
"/persons", headers={"Content-Type": "application/vnd.api+json",}
"/persons",
headers={
"Content-Type": "application/vnd.api+json",
},
)

assert response.status_code == 200, response.json
Expand Down Expand Up @@ -254,7 +257,10 @@ def test_accept_charset(person, person_2, client, registered_routes):
Check that a request with a valid Accept header but a charset parameter works
"""
response = client.get(
"/persons", headers={"Accept": "application/vnd.api+json; charset=utf-8",}
"/persons",
headers={
"Accept": "application/vnd.api+json; charset=utf-8",
},
)

assert response.status_code == 200, response.json
Expand Down
34 changes: 29 additions & 5 deletions tests/test_sqlalchemy_data_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,11 @@ def test_get_detail(client, registered_routes, person):

def test_get_detail_with_sparse_fieldsets(client, registered_routes, person):
with client:
querystring = urlencode({"fields[person]": "name",})
querystring = urlencode(
{
"fields[person]": "name",
}
)
response = client.get(
"/persons/" + str(person.person_id) + "?" + querystring,
content_type="application/vnd.api+json",
Expand Down Expand Up @@ -752,7 +756,9 @@ def get(self):
TestResource,
"resource_kwargs",
"/resource_kwargs",
resource_kwargs={"constant": "hello!",},
resource_kwargs={
"constant": "hello!",
},
)
api.init_app()
with app.test_client() as client:
Expand Down Expand Up @@ -1336,7 +1342,13 @@ def test_post_relationship_missing_type(client, registered_routes, computer, per


def test_post_relationship_missing_id(client, registered_routes, computer, person):
payload = {"data": [{"type": "computer",}]}
payload = {
"data": [
{
"type": "computer",
}
]
}

with client:
response = client.post(
Expand Down Expand Up @@ -1432,7 +1444,13 @@ def test_patch_relationship_missing_type(client, registered_routes, computer, pe


def test_patch_relationship_missing_id(client, registered_routes, computer, person):
payload = {"data": [{"type": "computer",}]}
payload = {
"data": [
{
"type": "computer",
}
]
}

with client:
response = client.patch(
Expand Down Expand Up @@ -1528,7 +1546,13 @@ def test_delete_relationship_missing_type(client, registered_routes, computer, p


def test_delete_relationship_missing_id(client, registered_routes, computer, person):
payload = {"data": [{"type": "computer",}]}
payload = {
"data": [
{
"type": "computer",
}
]
}

with client:
response = client.delete(
Expand Down