(backend) fix test after dependencies update

The queries needs update to manage save/release in database, this should
be improved, but considered ok for now.
This commit is contained in:
Quentin BEY
2025-04-22 12:57:33 +02:00
parent b42cd483c6
commit 4c14f967b6
5 changed files with 12 additions and 8 deletions

View File

@@ -411,7 +411,7 @@ def test_authentication_getter_existing_user_via_email_update_organization(
monkeypatch.setattr(OIDCAuthenticationBackend, "get_userinfo", get_userinfo_mocked)
with django_assert_num_queries(9):
with django_assert_num_queries(11):
user = klass.get_or_create_user(
access_token="test-token", id_token=None, payload=None
)

View File

@@ -52,8 +52,8 @@ def test_api_contacts_update_authenticated_owned(django_assert_num_queries):
).data
new_contact_values["override"] = str(factories.ContactFactory().id)
with django_assert_num_queries(8):
# user, 2x contact, user, 3x check, update contact
with django_assert_num_queries(14):
# user, 2x contact, user, 3x check, update contact, 3x savepoint/release
response = client.put(
f"/api/v1.0/contacts/{contact.id!s}/",
new_contact_values,

View File

@@ -35,7 +35,7 @@ def test_models_team_accesses_unique():
with pytest.raises(
ValidationError,
match="Team/user relation with this User and Team already exists.",
match="This user is already in this team.",
):
factories.TeamAccessFactory(user=access.user, team=access.team)

View File

@@ -478,9 +478,13 @@ class Base(Configuration):
environ_prefix=None,
)
USER_OIDC_FIELDS_TO_FULLNAME = values.ListValue(
default=["first_name", "last_name"],
environ_name="USER_OIDC_FIELDS_TO_FULLNAME",
OIDC_USERINFO_FULLNAME_FIELDS = values.ListValue(
default=values.ListValue( # retrocompatibility
default=["first_name", "last_name"],
environ_name="USER_OIDC_FIELDS_TO_FULLNAME",
environ_prefix=None,
),
environ_name="OIDC_USERINFO_FULLNAME_FIELDS",
environ_prefix=None,
)
OIDC_ORGANIZATION_REGISTRATION_ID_FIELD = values.Value(

View File

@@ -50,7 +50,7 @@ backend:
key: OIDC_RP_CLIENT_SECRET
OIDC_RP_SIGN_ALGO: RS256
OIDC_RP_SCOPES: "openid email siret given_name usual_name"
USER_OIDC_FIELDS_TO_FULLNAME: "given_name,usual_name"
OIDC_USERINFO_FULLNAME_FIELDS: "given_name,usual_name"
OIDC_REDIRECT_ALLOWED_HOSTS: https://desk.127.0.0.1.nip.io
OIDC_AUTH_REQUEST_EXTRA_PARAMS: "{'acr_values': 'eidas1'}"
OAUTH2_PROVIDER_OIDC_ENABLED: True