style: apply ruff format across backend + scripts (line-length 100)
Mechanical, whole-tree `ruff format` pass — no behaviour change. Recorded in .git-blame-ignore-revs (next commit) so git blame skips it.
This commit is contained in:
@@ -5,6 +5,7 @@ clamp that string went straight into Notification.title (String(255)) and, at th
|
||||
download_gc commit, raised psycopg StringDataRightTruncation — aborting the entire GC run so
|
||||
no expiry deletion / LRU eviction / orphan reap ever ran. The clamp trims the title to the
|
||||
column limit centrally, defending all callers regardless of DB backend."""
|
||||
|
||||
from app.models import Notification, User
|
||||
from app.notifications import TITLE_MAX_LEN, create_notification
|
||||
|
||||
@@ -28,9 +29,7 @@ class _CaptureDB:
|
||||
|
||||
def test_title_clamped_to_column_limit():
|
||||
long_title = "x" * 2000 # e.g. a reel caption
|
||||
notif = create_notification(
|
||||
_CaptureDB(), user_id=1, type="download_expiring", title=long_title
|
||||
)
|
||||
notif = create_notification(_CaptureDB(), user_id=1, type="download_expiring", title=long_title)
|
||||
assert len(notif.title) == TITLE_MAX_LEN
|
||||
assert notif.title.endswith("…")
|
||||
# The untruncated title still reaches the client via `data`, which is never clamped.
|
||||
@@ -68,8 +67,6 @@ def test_over_long_title_actually_commits_on_postgres(db):
|
||||
user = User(email="reel@example.com")
|
||||
db.add(user)
|
||||
db.flush()
|
||||
notif = create_notification(
|
||||
db, user_id=user.id, type="download_expiring", title="z" * 2000
|
||||
)
|
||||
notif = create_notification(db, user_id=user.id, type="download_expiring", title="z" * 2000)
|
||||
db.refresh(notif)
|
||||
assert len(notif.title) == TITLE_MAX_LEN # persisted, not truncated by the DB
|
||||
|
||||
Reference in New Issue
Block a user