style: format test files
Some checks failed
CI / Lint & Format (push) Successful in 18s
CI / Security Scan (push) Successful in 22s
CI / Tests (push) Failing after 19s

This commit is contained in:
Username
2025-12-22 20:04:46 +01:00
parent a469fc3343
commit ceb81fdd7c
3 changed files with 15 additions and 39 deletions

View File

@@ -513,12 +513,12 @@ class TestConcurrentSubmissions:
# First max_allowed should succeed
for i in range(max_allowed):
assert results[i][0] is True, f"Check {i+1} should be allowed"
assert results[i][1] == i + 1, f"Check {i+1} should have count {i+1}"
assert results[i][0] is True, f"Check {i + 1} should be allowed"
assert results[i][1] == i + 1, f"Check {i + 1} should have count {i + 1}"
# Rest should be denied
for i in range(max_allowed, len(results)):
assert results[i][0] is False, f"Check {i+1} should be denied"
assert results[i][0] is False, f"Check {i + 1} should be denied"
assert results[i][1] == max_allowed, f"Count should stay at {max_allowed}"
# Verify final database state

View File

@@ -164,9 +164,7 @@ def running_container(container_runtime, built_image):
yield BASE_URL
# Cleanup: stop and remove container
subprocess.run(
[container_runtime, "rm", "-f", CONTAINER_NAME], capture_output=True, timeout=30
)
subprocess.run([container_runtime, "rm", "-f", CONTAINER_NAME], capture_output=True, timeout=30)
class TestContainerBuild:
@@ -239,9 +237,7 @@ class TestContainerRuntime:
paste_id = create_response.json()["id"]
# Retrieve
get_response = requests.get(
f"{running_container}/raw/{paste_id}", timeout=REQUEST_TIMEOUT
)
get_response = requests.get(f"{running_container}/raw/{paste_id}", timeout=REQUEST_TIMEOUT)
assert get_response.status_code == 200
assert get_response.content == content
@@ -257,9 +253,7 @@ class TestContainerRuntime:
paste_id = create_response.json()["id"]
# Get info
info_response = requests.get(
f"{running_container}/{paste_id}", timeout=REQUEST_TIMEOUT
)
info_response = requests.get(f"{running_container}/{paste_id}", timeout=REQUEST_TIMEOUT)
assert info_response.status_code == 200
info = info_response.json()
assert info["id"] == paste_id
@@ -291,9 +285,7 @@ class TestContainerRuntime:
def test_not_found_returns_json(self, running_container):
"""404 errors should return JSON."""
response = requests.get(
f"{running_container}/raw/nonexistent1234", timeout=REQUEST_TIMEOUT
)
response = requests.get(f"{running_container}/raw/nonexistent1234", timeout=REQUEST_TIMEOUT)
assert response.status_code == 404
assert "application/json" in response.headers.get("Content-Type", "")
data = response.json()

View File

@@ -150,9 +150,7 @@ class TestPastesList:
assert data["count"] == 2
assert data["offset"] == 2
def test_list_returns_metadata_only(
self, app: Flask, auth_client: FlaskClient
) -> None:
def test_list_returns_metadata_only(self, app: Flask, auth_client: FlaskClient) -> None:
"""List should return metadata, not content."""
with app.app_context():
create_paste(auth_client, b"secret content", owner="a" * 40)
@@ -232,9 +230,7 @@ class TestPastesSearch:
for paste in data["pastes"]:
assert paste["created_at"] <= future
def test_search_combined_filters(
self, app: Flask, auth_client: FlaskClient
) -> None:
def test_search_combined_filters(self, app: Flask, auth_client: FlaskClient) -> None:
"""Multiple filters can be combined."""
with app.app_context():
create_paste(auth_client, b"test", owner="a" * 40)
@@ -262,9 +258,7 @@ class TestPasteUpdate:
response = client.put(f"/{paste_id}", data=b"new content")
assert response.status_code == 401
def test_update_requires_ownership(
self, app: Flask, auth_client: FlaskClient
) -> None:
def test_update_requires_ownership(self, app: Flask, auth_client: FlaskClient) -> None:
"""Update requires paste ownership."""
with app.app_context():
# Create paste owned by different user
@@ -312,9 +306,7 @@ class TestPasteUpdate:
def test_update_password_remove(self, app: Flask, auth_client: FlaskClient) -> None:
"""Owner can remove password from paste."""
with app.app_context():
paste_id = create_paste(
auth_client, b"content", owner="a" * 40, password="secret"
)
paste_id = create_paste(auth_client, b"content", owner="a" * 40, password="secret")
response = auth_client.put(
f"/{paste_id}",
@@ -331,9 +323,7 @@ class TestPasteUpdate:
def test_update_extend_expiry(self, app: Flask, auth_client: FlaskClient) -> None:
"""Owner can extend paste expiry."""
with app.app_context():
paste_id = create_paste(
auth_client, b"content", owner="a" * 40, expires_in=3600
)
paste_id = create_paste(auth_client, b"content", owner="a" * 40, expires_in=3600)
# Get original expiry
info_response = auth_client.get(f"/{paste_id}")
original_expiry = info_response.get_json().get("expires_at")
@@ -362,14 +352,10 @@ class TestPasteUpdate:
response = auth_client.put("/000000000000", data=b"content")
assert response.status_code == 404
def test_update_burn_after_read_forbidden(
self, app: Flask, auth_client: FlaskClient
) -> None:
def test_update_burn_after_read_forbidden(self, app: Flask, auth_client: FlaskClient) -> None:
"""Cannot update burn-after-read pastes."""
with app.app_context():
paste_id = create_paste(
auth_client, b"content", owner="a" * 40, burn_after_read=True
)
paste_id = create_paste(auth_client, b"content", owner="a" * 40, burn_after_read=True)
response = auth_client.put(f"/{paste_id}", data=b"new content")
assert response.status_code == 400
@@ -405,9 +391,7 @@ class TestPasteDelete:
get_response = auth_client.get(f"/{paste_id}")
assert get_response.status_code == 404
def test_delete_requires_ownership(
self, app: Flask, auth_client: FlaskClient
) -> None:
def test_delete_requires_ownership(self, app: Flask, auth_client: FlaskClient) -> None:
"""Cannot delete paste owned by others."""
with app.app_context():
paste_id = create_paste(auth_client, b"content", owner="c" * 40)