Skip to content

Commit e350d7e

Browse files
committed
fixed test
1 parent c2107f7 commit e350d7e

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

tests/unit_tests/containers/test_containers.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import pytest
22
import responses # https://github.com/getsentry/responses
3+
from responses import matchers
34

45
from datacrunch.containers.containers import (
56
CONTAINER_DEPLOYMENTS_ENDPOINT,
@@ -657,16 +658,19 @@ def test_create_secret(self, containers_service, secrets_endpoint):
657658
responses.add(
658659
responses.POST,
659660
secrets_endpoint,
660-
json=SECRETS_DATA[0],
661-
status=200
661+
status=201,
662+
match=[
663+
matchers.json_params_matcher(
664+
# The test will now fail if the request body doesn't match the expected JSON structure
665+
{"name": SECRET_NAME, "value": SECRET_VALUE}
666+
)
667+
]
662668
)
663669

664670
# act
665-
secret = containers_service.create_secret(SECRET_NAME, SECRET_VALUE)
671+
containers_service.create_secret(SECRET_NAME, SECRET_VALUE)
666672

667673
# assert
668-
assert type(secret) == Secret
669-
assert secret.name == SECRET_NAME
670674
assert responses.assert_call_count(secrets_endpoint, 1) is True
671675

672676
@responses.activate

0 commit comments

Comments
 (0)