Skip to content

Commit

Permalink
♻️ [maykinmedia/open-api-framework#66] update old tests with new client
Browse files Browse the repository at this point in the history
  • Loading branch information
annashamray committed Nov 25, 2024
1 parent 329cc59 commit f643793
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 30 deletions.
4 changes: 0 additions & 4 deletions src/objects/conf/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@
# Relying Party name for WebAuthn (hardware tokens)
TWO_FACTOR_WEBAUTHN_RP_NAME = "objects api"


# VNG API Common
CUSTOM_CLIENT_FETCHER = "objects.utils.client.get_client"

# settings for sending notifications
NOTIFICATIONS_KANAAL = "objecten"

Expand Down
13 changes: 1 addition & 12 deletions src/objects/core/tests/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,11 @@

import factory
from factory.fuzzy import BaseFuzzyAttribute
from zgw_consumers.constants import APITypes, AuthTypes
from zgw_consumers.models import Service
from zgw_consumers.test.factories import ServiceFactory

from ..models import Object, ObjectRecord, ObjectType


class ServiceFactory(factory.django.DjangoModelFactory):
label = factory.Faker("word")
api_root = factory.Faker("url")
api_type = APITypes.orc
auth_type = AuthTypes.no_auth

class Meta:
model = Service


class ObjectTypeFactory(factory.django.DjangoModelFactory):
service = factory.SubFactory(ServiceFactory)
uuid = factory.LazyFunction(uuid.uuid4)
Expand Down
1 change: 1 addition & 0 deletions src/objects/fixtures/demodata.json
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,7 @@
"pk": 1,
"fields": {
"label": "Objecttypen API",
"slug": "objecttypen-api",
"api_type": "orc",
"api_root": "http://localhost:8001/api/v1/",
"client_id": "",
Expand Down
14 changes: 7 additions & 7 deletions src/objects/tests/v2/test_notifications_kanaal.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_kanaal_create_with_name(self, mock_get_client):
Test is request to create kanaal is send with specified kanaal name
"""
client = mock_get_client.return_value
client.list.return_value = []
client.get.return_value = []

stdout = StringIO()
call_command(
Expand All @@ -56,9 +56,9 @@ def test_kanaal_create_with_name(self, mock_get_client):
stdout=stdout,
)

client.create.assert_called_once_with(
client.post.assert_called_once_with(
"kanaal",
{
json={
"naam": "kanaal_test",
"documentatieLink": "https://example.com/ref/kanalen/#kanaal_test",
"filters": [],
Expand All @@ -72,27 +72,27 @@ def test_kanaal_create_without_name(self, mock_get_client):
Test is request to create kanaal is send with default kanaal name
"""
client = mock_get_client.return_value
client.list.return_value = []
client.get.return_value = []

stdout = StringIO()
call_command(
"register_kanalen",
stdout=stdout,
)

client.create.assert_has_calls(
client.post.assert_has_calls(
[
call(
"kanaal",
{
json={
"naam": "kanaal_test",
"documentatieLink": "https://example.com/ref/kanalen/#kanaal_test",
"filters": [],
},
),
call(
"kanaal",
{
json={
"naam": "objecten",
"documentatieLink": "https://example.com/ref/kanalen/#objecten",
"filters": ["object_type"],
Expand Down
7 changes: 0 additions & 7 deletions src/objects/utils/client.py

This file was deleted.

0 comments on commit f643793

Please sign in to comment.