reformatted code again
i should probably put Black in a commit hook or something but nahhhh can't be that bad
This commit is contained in:
parent
bb3731cc6d
commit
2388bac57f
@ -30,10 +30,7 @@ class FilesMetadataAPI(ModelAPI):
|
|||||||
try:
|
try:
|
||||||
uuid.UUID(share_id)
|
uuid.UUID(share_id)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return jsonify(dict(
|
return jsonify(dict(status="fail", message=f"Invalid ID: '{share_id}'."))
|
||||||
status="fail",
|
|
||||||
message=f"Invalid ID: '{share_id}'."
|
|
||||||
))
|
|
||||||
share = Share.query.filter_by(share_id=share_id).first()
|
share = Share.query.filter_by(share_id=share_id).first()
|
||||||
return super().delete(share)
|
return super().delete(share)
|
||||||
|
|
||||||
|
@ -251,8 +251,10 @@ class ModelListAPI(MethodView):
|
|||||||
page_data = ModelClass.query.paginate(page=page, per_page=per_page)
|
page_data = ModelClass.query.paginate(page=page, per_page=per_page)
|
||||||
data = [model.get_schema().dump(model) for model in page_data]
|
data = [model.get_schema().dump(model) for model in page_data]
|
||||||
|
|
||||||
return jsonify(dict(
|
return jsonify(
|
||||||
data=data,
|
dict(
|
||||||
prev=page_data.prev_num,
|
data=data,
|
||||||
next=page_data.next_num,
|
prev=page_data.prev_num,
|
||||||
))
|
next=page_data.next_num,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
@ -91,9 +91,7 @@ class TestSuite:
|
|||||||
resp = client.put(
|
resp = client.put(
|
||||||
url + "/content",
|
url + "/content",
|
||||||
headers=auth("jeff"),
|
headers=auth("jeff"),
|
||||||
data={
|
data={"upload": FileStorage(stream=BytesIO(new_data), filename="upload")},
|
||||||
"upload": FileStorage(stream=BytesIO(new_data), filename="upload")
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
assert resp.status_code == 200
|
assert resp.status_code == 200
|
||||||
|
|
||||||
@ -105,7 +103,6 @@ class TestSuite:
|
|||||||
assert resp.data == new_data
|
assert resp.data == new_data
|
||||||
assert "filename=new_bin.bin" in resp.headers["Content-Disposition"].split("; ")
|
assert "filename=new_bin.bin" in resp.headers["Content-Disposition"].split("; ")
|
||||||
|
|
||||||
|
|
||||||
def test_invalid(self, client, users, auth, rand):
|
def test_invalid(self, client, users, auth, rand):
|
||||||
"""Test invalid requests."""
|
"""Test invalid requests."""
|
||||||
|
|
||||||
|
@ -45,10 +45,7 @@ def test_files(client, users, auth):
|
|||||||
per_page = 9
|
per_page = 9
|
||||||
while page is not None:
|
while page is not None:
|
||||||
resp = client.get(
|
resp = client.get(
|
||||||
"/files", headers=auth("jeff"), json=dict(
|
"/files", headers=auth("jeff"), json=dict(page=page, per_page=per_page)
|
||||||
page=page,
|
|
||||||
per_page=per_page
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
assert resp.status_code == 200
|
assert resp.status_code == 200
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user