fix(backend): supprime les vulnerabilites Sonar du Dockerfile et allege les tests d'exception

This commit is contained in:
Dorian
2026-09-21 14:08:04 +02:00
parent 44f3416ffe
commit 2adfdf0eb0
10 changed files with 312 additions and 284 deletions
@@ -49,8 +49,10 @@ async def test_the_database_refuses_to_mutate_the_audit_log(
) -> None:
await une_ligne(session)
requete = text(instruction)
with pytest.raises(DBAPIError, match="ajout seul"):
await session.execute(text(instruction))
await session.execute(requete)
await session.rollback()
@@ -131,11 +131,14 @@ async def test_the_database_refuses_two_tokens_sharing_a_fingerprint(
user_agent=None,
)
empreinte = fingerprint_refresh(secret)
expiration = datetime.now(UTC) + DUREE
with pytest.raises(IntegrityError):
await depot.create(
user_id=compte,
token_hash=fingerprint_refresh(secret),
expires_at=datetime.now(UTC) + DUREE,
token_hash=empreinte,
expires_at=expiration,
client_ip=None,
user_agent=None,
)
@@ -178,12 +178,16 @@ async def test_the_database_refuses_two_tokens_sharing_a_fingerprint(
user_agent=None,
)
famille = uuid.uuid4()
empreinte = fingerprint_refresh(secret)
expiration = datetime.now(UTC) + DUREE
with pytest.raises(IntegrityError):
await depot.create(
user_id=compte,
family_id=uuid.uuid4(),
token_hash=fingerprint_refresh(secret),
expires_at=datetime.now(UTC) + DUREE,
family_id=famille,
token_hash=empreinte,
expires_at=expiration,
client_ip=None,
user_agent=None,
)
+5 -7
View File
@@ -31,14 +31,12 @@ async def test_the_database_refuses_an_email_written_in_upper_case(
) -> None:
saisie = adresse().upper()
requete = text(
"insert into app_user (email, password_hash, role) values (:e, '$argon2id$x', 'lecteur')"
)
with pytest.raises(IntegrityError):
await session.execute(
text(
"insert into app_user (email, password_hash, role) "
"values (:e, '$argon2id$x', 'lecteur')"
),
{"e": saisie},
)
await session.execute(requete, {"e": saisie})
await session.rollback()