1
1
import logging
2
2
from functools import wraps
3
3
from inspect import Parameter , signature
4
- from unittest .test .testmock .support import is_instance
5
4
6
5
import pytest
7
6
@@ -85,7 +84,11 @@ def response_does_not_contain_write_only_properties(resource_client, response):
85
84
def response_contains_resource_model_equal_current_model (
86
85
response , current_resource_model
87
86
):
88
- assert response ["resourceModel" ] == current_resource_model
87
+ assert (
88
+ response ["resourceModel" ] == current_resource_model
89
+ ), "All properties specified in the request MUST be present in the model \
90
+ returned, and they MUST match exactly, with the exception of properties\
91
+ defined as writeOnlyProperties in the resource schema"
89
92
90
93
91
94
@decorate ()
@@ -95,7 +98,9 @@ def response_contains_resource_model_equal_updated_model(
95
98
assert response ["resourceModel" ] == {
96
99
** current_resource_model ,
97
100
** update_resource_model ,
98
- }
101
+ }, "All properties specified in the update request MUST be present in the \
102
+ model returned, and they MUST match exactly, with the exception of \
103
+ properties defined as writeOnlyProperties in the resource schema"
99
104
100
105
101
106
@decorate ()
@@ -109,11 +114,12 @@ def response_contains_primary_identifier(resource_client, response):
109
114
def response_contains_unchanged_primary_identifier (
110
115
resource_client , response , current_resource_model
111
116
):
112
- resource_client .is_primary_identifier_equal (
117
+ assert resource_client .is_primary_identifier_equal (
113
118
resource_client .primary_identifier_paths ,
114
119
current_resource_model ,
115
120
response ["resourceModel" ],
116
- )
121
+ ), "PrimaryIdentifier returned in every progress event must match \
122
+ the primaryIdentifier passed into the request"
117
123
118
124
119
125
@decorate (after = False )
@@ -128,7 +134,7 @@ def decorator_wrapper(func: object):
128
134
def wrapper (* args , ** kwargs ):
129
135
response_error = func (* args , ** kwargs )
130
136
if response_error is not None :
131
- if is_instance (error_code , HandlerErrorCode ):
137
+ if isinstance (error_code , HandlerErrorCode ):
132
138
error_code_tuple = (error_code ,)
133
139
assert response_error in error_code_tuple , msg
134
140
return response_error
0 commit comments