(json_description, case, basename)
| 142 | "json_description, case, basename", _compliance_tests(TestType.INPUT) |
| 143 | ) |
| 144 | def test_input_compliance(json_description, case, basename): |
| 145 | service_description = copy.deepcopy(json_description) |
| 146 | service_description['operations'] = { |
| 147 | case.get('given', {}).get('name', 'OperationName'): case, |
| 148 | } |
| 149 | model = ServiceModel(service_description) |
| 150 | protocol_type = model.metadata['protocol'] |
| 151 | try: |
| 152 | protocol_serializer = PROTOCOL_SERIALIZERS[protocol_type] |
| 153 | except KeyError: |
| 154 | raise RuntimeError(f"Unknown protocol: {protocol_type}") |
| 155 | serializer = protocol_serializer() |
| 156 | serializer.MAP_TYPE = OrderedDict |
| 157 | operation_model = OperationModel(case['given'], model) |
| 158 | case['params'] = _convert_strings_to_special_float(case['params']) |
| 159 | request = serializer.serialize_to_request(case['params'], operation_model) |
| 160 | _serialize_request_description(request) |
| 161 | client_endpoint = service_description.get('clientEndpoint') |
| 162 | try: |
| 163 | _assert_request_body_is_bytes(request['body']) |
| 164 | _assert_requests_equal( |
| 165 | request, case['serialized'], protocol_type, operation_model |
| 166 | ) |
| 167 | _assert_endpoints_equal(request, case['serialized'], client_endpoint) |
| 168 | except AssertionError as e: |
| 169 | _input_failure_message(protocol_type, case, request, e) |
| 170 | |
| 171 | |
| 172 | def _assert_request_body_is_bytes(body): |
nothing calls this directly
no test coverage detected