|
9 | 9 | from rpdk.core.contract.suite.contract_asserts import failed_event
|
10 | 10 |
|
11 | 11 |
|
12 |
| -@pytest.mark.update |
13 |
| -@failed_event( |
14 |
| - error_code=(HandlerErrorCode.NotUpdatable, HandlerErrorCode.NotFound), |
15 |
| - msg="An update hander MUST return FAILED with a NotUpdatable error code \ |
16 |
| - if the difference between the previous state and the properties included \ |
17 |
| - in the request contains a property defined in the createOnlyProperties \ |
18 |
| - in the resource schema", |
19 |
| -) |
20 |
| -def contract_update_create_only_property(resource_client): |
21 |
| - |
22 |
| - if resource_client.create_only_paths: |
23 |
| - create_request = resource_client.generate_create_example() |
24 |
| - try: |
25 |
| - _status, response, _error = resource_client.call_and_assert( |
26 |
| - Action.CREATE, OperationStatus.SUCCESS, create_request |
27 |
| - ) |
28 |
| - created_model = response["resourceModel"] |
29 |
| - update_request = resource_client.generate_invalid_update_example( |
30 |
| - created_model |
31 |
| - ) |
32 |
| - _status, response, _error_code = resource_client.call_and_assert( |
33 |
| - Action.UPDATE, OperationStatus.FAILED, update_request, created_model |
34 |
| - ) |
35 |
| - assert response[ |
36 |
| - "message" |
37 |
| - ], "The progress event MUST return an error message\ |
38 |
| - when the status is failed" |
39 |
| - finally: |
40 |
| - resource_client.call_and_assert( |
41 |
| - Action.DELETE, OperationStatus.SUCCESS, created_model |
42 |
| - ) |
43 |
| - else: |
44 |
| - pytest.skip("No createOnly Properties. Skipping test.") |
45 |
| - |
46 |
| - |
47 | 12 | @pytest.mark.update
|
48 | 13 | @failed_event(
|
49 | 14 | error_code=HandlerErrorCode.NotFound,
|
|
0 commit comments