style: formater le depot avec ruff format
QUA-002, premiere moitie. **Ce commit ne fait que reformater** : aucun changement de comportement, aucune ligne de logique touchee. 72 fichiers, 4 restaient deja conformes. Il est isole exprès, pour que `git log -p` sur les commits voisins reste lisible. `quote-style = "preserve"` etait deja pose dans pyproject.toml, ce qui evite le brassage guillemets simples / doubles : le diff porte sur les retours a la ligne, l indentation des appels longs et les virgules finales, pas sur le style de chaine. Verification : 263 tests passent avant et apres, ruff check propre. L activation en CI arrive dans le commit suivant, separement, pour que ce diff-ci ne contienne rien d autre. Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
+60
-22
@@ -106,10 +106,17 @@ class TestAdministrativeEvents:
|
||||
def test_account_creation_is_recorded(self, client, as_role, auth_log):
|
||||
as_role('admin')
|
||||
|
||||
client.post('/users/create', data={
|
||||
'username': 'newcoach', 'email': '[email protected]',
|
||||
'password': 'Password123', 'full_name': 'New Coach', 'role': 'coach',
|
||||
}, follow_redirects=True)
|
||||
client.post(
|
||||
'/users/create',
|
||||
data={
|
||||
'username': 'newcoach',
|
||||
'email': '[email protected]',
|
||||
'password': 'Password123',
|
||||
'full_name': 'New Coach',
|
||||
'role': 'coach',
|
||||
},
|
||||
follow_redirects=True,
|
||||
)
|
||||
|
||||
assert _has_event(auth_log, 'account.created_by_admin')
|
||||
|
||||
@@ -117,10 +124,16 @@ class TestAdministrativeEvents:
|
||||
target_id = make_user('player')
|
||||
as_role('admin')
|
||||
|
||||
client.post(f'/users/{target_id}/edit', data={
|
||||
'full_name': 'Promoted', 'email': '[email protected]t',
|
||||
'role': 'coach', 'is_active_account': 'on',
|
||||
}, follow_redirects=True)
|
||||
client.post(
|
||||
f'/users/{target_id}/edit',
|
||||
data={
|
||||
'full_name': 'Promoted',
|
||||
'email': '[email protected]',
|
||||
'role': 'coach',
|
||||
'is_active_account': 'on',
|
||||
},
|
||||
follow_redirects=True,
|
||||
)
|
||||
|
||||
message = next(m for m in _events(auth_log) if 'event=account.role_changed' in m)
|
||||
assert 'previous_role=player' in message
|
||||
@@ -135,17 +148,21 @@ class TestAdministrativeEvents:
|
||||
|
||||
assert _has_event(auth_log, 'account.deleted')
|
||||
|
||||
def test_a_self_service_password_change_is_recorded(
|
||||
self, app, client, as_role, auth_log
|
||||
):
|
||||
def test_a_self_service_password_change_is_recorded(self, app, client, as_role, auth_log):
|
||||
user_id = as_role('player')
|
||||
with app.app_context():
|
||||
username = db.session.get(User, user_id).username
|
||||
|
||||
client.post('/users/profile/edit', data={
|
||||
'username': username, 'full_name': 'Same Name',
|
||||
'email': '[email protected]', 'password': 'BrandNew123',
|
||||
}, follow_redirects=True)
|
||||
client.post(
|
||||
'/users/profile/edit',
|
||||
data={
|
||||
'username': username,
|
||||
'full_name': 'Same Name',
|
||||
'email': '[email protected]',
|
||||
'password': 'BrandNew123',
|
||||
},
|
||||
follow_redirects=True,
|
||||
)
|
||||
|
||||
assert _has_event(auth_log, 'account.password_changed')
|
||||
|
||||
@@ -162,8 +179,13 @@ class TestRedaction:
|
||||
from app.logging_config import SensitiveDataFilter
|
||||
|
||||
record = logging.LogRecord(
|
||||
'test', logging.ERROR, 'x.py', 1,
|
||||
'Database failure: %s', ('password=hunter2 host=db.internal',), None,
|
||||
'test',
|
||||
logging.ERROR,
|
||||
'x.py',
|
||||
1,
|
||||
'Database failure: %s',
|
||||
('password=hunter2 host=db.internal',),
|
||||
None,
|
||||
)
|
||||
SensitiveDataFilter().filter(record)
|
||||
|
||||
@@ -175,8 +197,13 @@ class TestRedaction:
|
||||
from app.logging_config import SensitiveDataFilter
|
||||
|
||||
record = logging.LogRecord(
|
||||
'test', logging.INFO, 'x.py', 1,
|
||||
'Calling Discord with %s', ('Bearer abcdef123456',), None,
|
||||
'test',
|
||||
logging.INFO,
|
||||
'x.py',
|
||||
1,
|
||||
'Calling Discord with %s',
|
||||
('Bearer abcdef123456',),
|
||||
None,
|
||||
)
|
||||
SensitiveDataFilter().filter(record)
|
||||
|
||||
@@ -186,8 +213,13 @@ class TestRedaction:
|
||||
from app.logging_config import SensitiveDataFilter
|
||||
|
||||
record = logging.LogRecord(
|
||||
'test', logging.INFO, 'x.py', 1,
|
||||
'event=login.success username=%s', ('alice',), None,
|
||||
'test',
|
||||
logging.INFO,
|
||||
'x.py',
|
||||
1,
|
||||
'event=login.success username=%s',
|
||||
('alice',),
|
||||
None,
|
||||
)
|
||||
SensitiveDataFilter().filter(record)
|
||||
|
||||
@@ -197,6 +229,12 @@ class TestRedaction:
|
||||
from app.logging_config import SensitiveDataFilter
|
||||
|
||||
record = logging.LogRecord(
|
||||
'test', logging.INFO, 'x.py', 1, 'broken %d', ('not-a-number',), None,
|
||||
'test',
|
||||
logging.INFO,
|
||||
'x.py',
|
||||
1,
|
||||
'broken %d',
|
||||
('not-a-number',),
|
||||
None,
|
||||
)
|
||||
assert SensitiveDataFilter().filter(record) is True
|
||||
|
||||
Reference in New Issue
Block a user