Skip to content

Commit

Permalink
removing contract_update_create_only_property (aws-cloudformation#721)
Browse files Browse the repository at this point in the history
  • Loading branch information
PatMyron authored and kddejong committed Oct 24, 2022
1 parent 387aea1 commit 89c1af1
Showing 1 changed file with 0 additions and 35 deletions.
35 changes: 0 additions & 35 deletions src/rpdk/core/contract/suite/handler_update_invalid.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,41 +9,6 @@
from rpdk.core.contract.suite.contract_asserts import failed_event


@pytest.mark.update
@failed_event(
error_code=(HandlerErrorCode.NotUpdatable, HandlerErrorCode.NotFound),
msg="An update hander MUST return FAILED with a NotUpdatable error code \
if the difference between the previous state and the properties included \
in the request contains a property defined in the createOnlyProperties \
in the resource schema",
)
def contract_update_create_only_property(resource_client):

if resource_client.create_only_paths:
create_request = resource_client.generate_create_example()
try:
_status, response, _error = resource_client.call_and_assert(
Action.CREATE, OperationStatus.SUCCESS, create_request
)
created_model = response["resourceModel"]
update_request = resource_client.generate_invalid_update_example(
created_model
)
_status, response, _error_code = resource_client.call_and_assert(
Action.UPDATE, OperationStatus.FAILED, update_request, created_model
)
assert response[
"message"
], "The progress event MUST return an error message\
when the status is failed"
finally:
resource_client.call_and_assert(
Action.DELETE, OperationStatus.SUCCESS, created_model
)
else:
pytest.skip("No createOnly Properties. Skipping test.")


@pytest.mark.update
@failed_event(
error_code=HandlerErrorCode.NotFound,
Expand Down

0 comments on commit 89c1af1

Please sign in to comment.