Skip to content

Commit

Permalink
Merge pull request #18 from maykinmedia/issue/config-view-500
Browse files Browse the repository at this point in the history
🐛 add COMMONGROUND_API_COMMON_GET_DOMAIN to the exported vars
  • Loading branch information
annashamray authored Dec 7, 2023
2 parents c31dc82 + 448a36e commit aa450f9
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 0 deletions.
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

0 comments on commit aa450f9

Please sign in to comment.