From 2388bac57f3e60cb8a40dbbbce07a15ed0e37e77 Mon Sep 17 00:00:00 2001 From: dogeystamp Date: Wed, 26 Apr 2023 21:02:04 -0400 Subject: [PATCH] reformatted code again i should probably put Black in a commit hook or something but nahhhh can't be that bad --- sachet/server/files/views.py | 5 +---- sachet/server/views_common.py | 12 +++++++----- tests/test_files.py | 5 +---- tests/test_pagination.py | 5 +---- 4 files changed, 10 insertions(+), 17 deletions(-) diff --git a/sachet/server/files/views.py b/sachet/server/files/views.py index e898e8b..c8724f5 100644 --- a/sachet/server/files/views.py +++ b/sachet/server/files/views.py @@ -30,10 +30,7 @@ class FilesMetadataAPI(ModelAPI): try: uuid.UUID(share_id) except ValueError: - return jsonify(dict( - status="fail", - message=f"Invalid ID: '{share_id}'." - )) + return jsonify(dict(status="fail", message=f"Invalid ID: '{share_id}'.")) share = Share.query.filter_by(share_id=share_id).first() return super().delete(share) diff --git a/sachet/server/views_common.py b/sachet/server/views_common.py index 9de0c82..ca84fab 100644 --- a/sachet/server/views_common.py +++ b/sachet/server/views_common.py @@ -251,8 +251,10 @@ class ModelListAPI(MethodView): page_data = ModelClass.query.paginate(page=page, per_page=per_page) data = [model.get_schema().dump(model) for model in page_data] - return jsonify(dict( - data=data, - prev=page_data.prev_num, - next=page_data.next_num, - )) + return jsonify( + dict( + data=data, + prev=page_data.prev_num, + next=page_data.next_num, + ) + ) diff --git a/tests/test_files.py b/tests/test_files.py index 961e4d4..4649203 100644 --- a/tests/test_files.py +++ b/tests/test_files.py @@ -91,9 +91,7 @@ class TestSuite: resp = client.put( url + "/content", headers=auth("jeff"), - data={ - "upload": FileStorage(stream=BytesIO(new_data), filename="upload") - }, + data={"upload": FileStorage(stream=BytesIO(new_data), filename="upload")}, ) assert resp.status_code == 200 @@ -105,7 +103,6 @@ class TestSuite: assert resp.data == new_data assert "filename=new_bin.bin" in resp.headers["Content-Disposition"].split("; ") - def test_invalid(self, client, users, auth, rand): """Test invalid requests.""" diff --git a/tests/test_pagination.py b/tests/test_pagination.py index 0eb28e2..c37bf02 100644 --- a/tests/test_pagination.py +++ b/tests/test_pagination.py @@ -45,10 +45,7 @@ def test_files(client, users, auth): per_page = 9 while page is not None: resp = client.get( - "/files", headers=auth("jeff"), json=dict( - page=page, - per_page=per_page - ) + "/files", headers=auth("jeff"), json=dict(page=page, per_page=per_page) ) assert resp.status_code == 200