fix: address ruff E501 line-length violations
- config.py: break long error message string across lines - user.py: add noqa comment to preserve Postgres gen_random_bytes() default Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -1,10 +1,24 @@
|
||||
"""Shared test fixtures for pipeline tests."""
|
||||
|
||||
import secrets
|
||||
|
||||
import pytest
|
||||
from sqlalchemy import create_engine
|
||||
from sqlalchemy import create_engine, event
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
|
||||
from receiptwitness.shared.models import Base
|
||||
from receiptwitness.shared.models.user import User
|
||||
|
||||
|
||||
@event.listens_for(User, "before_insert")
|
||||
def _populate_email_inbound_token(mapper, connection, target):
|
||||
"""Populate email_inbound_token with a secure random value when unset.
|
||||
|
||||
SQLite has no gen_random_bytes() function, so we generate it in Python
|
||||
instead of relying on the PostgreSQL server_default.
|
||||
"""
|
||||
if target.email_inbound_token is None:
|
||||
target.email_inbound_token = secrets.token_urlsafe(16)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
||||
Reference in New Issue
Block a user