Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removing contract_update_create_only_property #721

Merged
merged 1 commit into from
Apr 1, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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