Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#3856] Fix default auth type of autocreated objecttypes client #3865

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
PLUGIN_IDENTIFIER as OBJECTS_API_PLUGIN_IDENTIFIER,
)

from zgw_consumers.constants import APITypes
from zgw_consumers.constants import APITypes, AuthTypes

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -73,7 +73,11 @@ def create_objecttypes_api_service(

service, _ = Service.objects.get_or_create(
api_root=base,
defaults={"api_type": APITypes.orc, "oas": f"{base}schema/openapi.yaml"},
defaults={
"api_type": APITypes.orc,
"auth_type": AuthTypes.api_key,
"oas": f"{base}schema/openapi.yaml",
},
)
objects_api_config.objecttypes_service = service

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from django.db.migrations.state import StateApps

from zgw_consumers.constants import AuthTypes

from openforms.registrations.contrib.objects_api.plugin import (
PLUGIN_IDENTIFIER as OBJECTS_API_PLUGIN_IDENTIFIER,
)
Expand Down Expand Up @@ -27,6 +29,11 @@ def test_migration_sets_service_from_default_url(self):

objects_api_config = ObjectsAPIConfig.objects.get()

self.assertEqual(
objects_api_config.objecttypes_service.auth_type,
AuthTypes.api_key,
)

self.assertEqual(
objects_api_config.objecttypes_service.api_root,
"https://objecttypen.nl/path/api/v1/",
Expand Down
Loading