11
11
from ..client import get_objecttypes_client
12
12
from ..models import ObjectsAPIConfig
13
13
14
- OBJECTTYPES_API_BASE_URL = "http://localhost:8001/api/v2/"
15
14
16
- # The value is the API key loaded in the docker service:
17
- OBJECTTYPES_API_KEY = "171be5abaf41e7856b423ad513df1ef8f867ff48"
15
+ def get_test_config () -> ObjectsAPIConfig :
16
+ """Returns a preconfigured ``ObjectsAPIConfig`` instance matching the docker compose configuration."""
17
+ return ObjectsAPIConfig (
18
+ objecttypes_service = Service (
19
+ api_root = "http://localhost:8001/api/v2/" ,
20
+ api_type = APITypes .orc ,
21
+ oas = "https://example.com/" ,
22
+ header_key = "Authorization" ,
23
+ header_value = "Token 171be5abaf41e7856b423ad513df1ef8f867ff48" ,
24
+ auth_type = AuthTypes .api_key ,
25
+ )
26
+ )
18
27
19
28
20
29
class ObjecttypesClientTest (OFVCRMixin , TestCase ):
@@ -26,16 +35,7 @@ def setUp(self) -> None:
26
35
27
36
patcher = patch (
28
37
"openforms.registrations.contrib.objects_api.client.ObjectsAPIConfig.get_solo" ,
29
- return_value = ObjectsAPIConfig (
30
- objecttypes_service = Service (
31
- api_root = OBJECTTYPES_API_BASE_URL ,
32
- api_type = APITypes .orc ,
33
- oas = "https://example.com/" ,
34
- header_key = "Authorization" ,
35
- header_value = f"Token { OBJECTTYPES_API_KEY } " ,
36
- auth_type = AuthTypes .api_key ,
37
- )
38
- ),
38
+ return_value = get_test_config (),
39
39
)
40
40
41
41
self .config_mock = patcher .start ()
0 commit comments