fix lint issues across codebase

This commit is contained in:
Username
2025-12-20 17:20:27 +01:00
parent adbb5be5c0
commit 9da33f786e
6 changed files with 29 additions and 32 deletions

View File

@@ -37,14 +37,14 @@ class TestContentDedup:
# First 3 submissions should succeed
for i in range(3):
response = strict_client.post("/", data=content)
assert response.status_code == 201, f"Submission {i+1} failed"
assert response.status_code == 201, f"Submission {i + 1} failed"
def test_duplicate_exceeds_threshold_rejected(self, strict_client):
"""Fourth duplicate within window should be rejected."""
content = b"unique content 3"
# First 3 succeed
for i in range(3):
for _ in range(3):
response = strict_client.post("/", data=content)
assert response.status_code == 201
@@ -144,8 +144,7 @@ class TestContentHashDatabase:
# Query database directly
db = get_db()
row = db.execute(
"SELECT hash, count FROM content_hashes WHERE hash = ?",
(content_hash,)
"SELECT hash, count FROM content_hashes WHERE hash = ?", (content_hash,)
).fetchone()
assert row is not None
@@ -179,10 +178,7 @@ class TestContentHashCleanup:
# Verify removed
db = get_db()
row = db.execute(
"SELECT * FROM content_hashes WHERE hash = ?",
(content_hash,)
).fetchone()
row = db.execute("SELECT * FROM content_hashes WHERE hash = ?", (content_hash,)).fetchone()
assert row is None
def test_cleanup_keeps_recent(self, app_context):
@@ -193,14 +189,11 @@ class TestContentHashCleanup:
check_content_hash(content_hash)
# Cleanup should not remove it
deleted = cleanup_expired_hashes()
cleanup_expired_hashes()
# Verify still present
db = get_db()
row = db.execute(
"SELECT * FROM content_hashes WHERE hash = ?",
(content_hash,)
).fetchone()
row = db.execute("SELECT * FROM content_hashes WHERE hash = ?", (content_hash,)).fetchone()
assert row is not None
@@ -268,6 +261,7 @@ class TestEntropyEnforcement:
def test_random_data_accepted(self, entropy_client):
"""Random/encrypted data should pass entropy check."""
import os
random_data = os.urandom(512) # High entropy random bytes
response = entropy_client.post(