(actual, expected, protocol, operation_model)
| 461 | |
| 462 | |
| 463 | def _assert_requests_equal(actual, expected, protocol, operation_model): |
| 464 | # For CBOR, we need to assert that the bodies are equal based on their parsed |
| 465 | # values to ensure we are properly testing things like |
| 466 | if protocol == 'smithy-rpc-v2-cbor' and actual['body']: |
| 467 | parser = RpcV2CBORParser() |
| 468 | actual_body_stream = parser.get_peekable_stream_from_bytes( |
| 469 | actual['body'] |
| 470 | ) |
| 471 | expected_body_stream = parser.get_peekable_stream_from_bytes( |
| 472 | base64.b64decode(expected['body']) |
| 473 | ) |
| 474 | actual_body = _convert_special_floats_to_string( |
| 475 | parser.parse_data_item(actual_body_stream) |
| 476 | ) |
| 477 | expected_body = _convert_special_floats_to_string( |
| 478 | parser.parse_data_item(expected_body_stream) |
| 479 | ) |
| 480 | assert_equal(actual_body, expected_body, 'Body value') |
| 481 | elif 'body' in expected: |
| 482 | expected_body = expected['body'].encode('utf-8') |
| 483 | actual_body = actual['body'] |
| 484 | _assert_request_body(actual_body, expected_body, protocol) |
| 485 | actual_headers = HeadersDict(actual['headers']) |
| 486 | expected_headers = HeadersDict(expected.get('headers', {})) |
| 487 | excluded_headers = expected.get('forbidHeaders', []) |
| 488 | _assert_expected_headers_in_request( |
| 489 | actual_headers, |
| 490 | expected_headers, |
| 491 | excluded_headers, |
| 492 | protocol, |
| 493 | operation_model, |
| 494 | ) |
| 495 | assert_equal(actual['url_path'], expected.get('uri', ''), "URI") |
| 496 | if 'method' in expected: |
| 497 | assert_equal(actual['method'], expected['method'], "Method") |
| 498 | |
| 499 | |
| 500 | def _assert_request_body(actual, expected, protocol_type): |
no test coverage detected