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

🐛 add COMMONGROUND_API_COMMON_GET_DOMAIN to the exported vars #18

Merged
merged 2 commits into from
Dec 7, 2023
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
2 changes: 2 additions & 0 deletions testapp/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,5 @@
"SECURITY_DEFINITIONS": {SECURITY_DEFINITION_NAME: {}},
}
)

IS_HTTPS = False
3 changes: 3 additions & 0 deletions testapp/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

from rest_framework import routers

from vng_api_common.views import ViewConfigView

from .schema import SchemaView
from .views import NotificationView
from .viewsets import GroupViewSet, HobbyViewSet, PersonViewSet
Expand Down Expand Up @@ -37,6 +39,7 @@
path("api/", include(router.urls)),
path("api/", include("vng_api_common.api.urls")),
path("ref/", include("vng_api_common.urls")),
path("view-config/", ViewConfigView.as_view(), name="view-config"),
# this is a hack to get the parameter to show up in the API spec
# this effectively makes this a wildcard URL, so it should be LAST
path("<webhooks_path>", NotificationView.as_view()),
Expand Down
8 changes: 8 additions & 0 deletions testapp/utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Custom function to get client for ClientConfig models
def get_client(url):
return "testclient"


# Custom function to get client with auth for ClientConfig models
def get_client_with_auth(url):
class TestClient:
auth = None

return TestClient
18 changes: 18 additions & 0 deletions tests/test_views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from django.test import override_settings
from django.urls import reverse

import pytest
from rest_framework import status


@pytest.mark.django_db
@override_settings(CUSTOM_CLIENT_FETCHER="testapp.utils.get_client_with_auth")
def test_config_view(api_client):
"""
regression test for https://github.com/open-zaak/open-notificaties/issues/119
"""
path = reverse("view-config")

response = api_client.get(path)

assert response.status_code == status.HTTP_200_OK
1 change: 1 addition & 0 deletions vng_api_common/conf/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"NOTIFICATIONS_KANAAL",
"NOTIFICATIONS_DISABLED",
"JWT_LEEWAY",
"COMMONGROUND_API_COMMON_GET_DOMAIN",
]

API_VERSION = "1.0.0-rc1" # semantic version
Expand Down
Loading