Orchestrata Ultimate › Tests › Reference › postman › test_payload
Tests reference — tests/postman/test_payload.py
Module of tests/postman, split out because the directory page would be too large.
Prose pending.
tests/postman/test_payload.py
source · 90 tests · 1032 lines
Comprehensive tests for PayloadHandler class.
Covers: postman.constants, postman.exceptions, postman.payload, postman.types
| Kind | Name | Line | Description |
|---|---|---|---|
| class | TestValidation |
87 | Test payload validation functionality. |
| method | TestValidation.test_validate_small_json_payload |
90 | Validate small JSON payload is accepted. |
| method | TestValidation.test_validate_empty_json_payload |
98 | Validate empty JSON payload is accepted. |
| method | TestValidation.test_validate_text_payload |
106 | Validate text payload is accepted. |
| method | TestValidation.test_validate_binary_payload |
114 | Validate binary payload is accepted. |
| method | TestValidation.test_validate_compressed_payload |
122 | Validate compressed payload is accepted. |
| method | TestValidation.test_validate_oversized_payload |
130 | Validate oversized payload is rejected. |
| method | TestValidation.test_validate_custom_max_size |
139 | Validate custom max size is respected. |
| method | TestValidation.test_validate_unsupported_content_type |
147 | Validate unsupported content type is rejected. |
| method | TestValidation.test_validate_invalid_json |
155 | Validate invalid JSON payload is rejected. |
| method | TestValidation.test_validate_invalid_utf8_text |
163 | Validate invalid UTF-8 text payload is rejected. |
| method | TestValidation.test_validate_nested_json |
171 | Validate complex nested JSON is accepted. |
| method | TestValidation.test_validate_unicode_text |
181 | Validate Unicode text payload is accepted. |
| class | TestCompression |
195 | Test payload compression functionality. |
| method | TestCompression.test_compress_small_payload |
198 | Compress small payload successfully. |
| method | TestCompression.test_compress_large_payload |
209 | Compress large payload and verify size reduction. |
| method | TestCompression.test_compress_empty_payload |
223 | Compress empty payload successfully. |
| method | TestCompression.test_compress_binary_data |
232 | Compress binary data successfully. |
| method | TestCompression.test_compress_already_compressed |
242 | Compress already compressed data (double compression). |
| method | TestCompression.test_compress_raises_on_invalid_input |
256 | Compress with invalid input type raises error. |
| class | TestDecompression |
270 | Test payload decompression functionality. |
| method | TestDecompression.test_decompress_valid_payload |
273 | Decompress valid compressed payload. |
| method | TestDecompression.test_decompress_large_payload |
281 | Decompress large payload successfully. |
| method | TestDecompression.test_decompress_invalid_data |
291 | Decompress invalid data raises error. |
| method | TestDecompression.test_decompress_empty_data |
300 | Decompress empty data returns empty bytes. |
| method | TestDecompression.test_compress_decompress_roundtrip |
306 | Test compression and decompression roundtrip. |
| method | TestDecompression.test_decompress_partial_data |
314 | Decompress partial/corrupted data raises error. |
| class | TestEncoding |
332 | Test payload encoding functionality. |
| method | TestEncoding.test_encode_dict_to_json |
335 | Encode dictionary to JSON bytes. |
| method | TestEncoding.test_encode_list_to_json |
343 | Encode list to JSON bytes. |
| method | TestEncoding.test_encode_string_to_text |
352 | Encode string to text bytes. |
| method | TestEncoding.test_encode_bytes_to_binary |
361 | Encode bytes to binary (passthrough). |
| method | TestEncoding.test_encode_bytes_to_json |
369 | Encode bytes to JSON (passthrough). |
| method | TestEncoding.test_encode_bytes_to_text |
376 | Encode bytes to text (passthrough). |
| method | TestEncoding.test_encode_non_bytes_to_binary_fails |
383 | Encode non-bytes to binary raises error. |
| method | TestEncoding.test_encode_non_bytes_to_compressed_fails |
390 | Encode non-bytes to compressed raises error. |
| method | TestEncoding.test_encode_unsupported_content_type |
397 | Encode with unsupported content type raises error. |
| method | TestEncoding.test_encode_unicode_string |
404 | Encode Unicode string to text. |
| method | TestEncoding.test_encode_integer_to_json |
412 | Encode integer to JSON. |
| method | TestEncoding.test_encode_float_to_json |
421 | Encode float to JSON. |
| class | TestDecoding |
436 | Test payload decoding functionality. |
| method | TestDecoding.test_decode_json_to_dict |
439 | Decode JSON bytes to dictionary. |
| method | TestDecoding.test_decode_json_to_list |
446 | Decode JSON bytes to list. |
| method | TestDecoding.test_decode_text_to_string |
454 | Decode text bytes to string. |
| method | TestDecoding.test_decode_binary_passthrough |
463 | Decode binary bytes (passthrough). |
| method | TestDecoding.test_decode_compressed_data |
471 | Decode compressed data. |
| method | TestDecoding.test_decode_invalid_json |
480 | Decode invalid JSON raises error. |
| method | TestDecoding.test_decode_invalid_utf8_text |
489 | Decode invalid UTF-8 text raises error. |
| method | TestDecoding.test_decode_unsupported_content_type |
498 | Decode with unsupported content type raises error. |
| method | TestDecoding.test_decode_unicode_text |
507 | Decode Unicode text successfully. |
| method | TestDecoding.test_decode_json_integer |
515 | Decode JSON integer. |
| method | TestDecoding.test_decode_json_float |
523 | Decode JSON float. |
| class | TestContentTypeDetection |
537 | Test automatic content type detection. |
| method | TestContentTypeDetection.test_detect_dict_as_json |
540 | Detect dictionary as JSON. |
| method | TestContentTypeDetection.test_detect_list_as_json |
547 | Detect list as JSON. |
| method | TestContentTypeDetection.test_detect_int_as_json |
554 | Detect integer as JSON. |
| method | TestContentTypeDetection.test_detect_float_as_json |
561 | Detect float as JSON. |
| method | TestContentTypeDetection.test_detect_bool_as_json |
568 | Detect boolean as JSON. |
| method | TestContentTypeDetection.test_detect_none_as_json |
575 | Detect None as JSON. |
| method | TestContentTypeDetection.test_detect_string_as_text |
582 | Detect string as text. |
| method | TestContentTypeDetection.test_detect_utf8_bytes_as_text |
589 | Detect UTF-8 bytes as text. |
| method | TestContentTypeDetection.test_detect_binary_bytes_as_binary |
596 | Detect binary bytes as binary. |
| method | TestContentTypeDetection.test_detect_unicode_string_as_text |
603 | Detect Unicode string as text. |
| method | TestContentTypeDetection.test_detect_empty_dict_as_json |
610 | Detect empty dict as JSON. |
| method | TestContentTypeDetection.test_detect_empty_list_as_json |
617 | Detect empty list as JSON. |
| class | TestEncodeDecodeRoundtrip |
630 | Test encode/decode roundtrip for all content types. |
| method | TestEncodeDecodeRoundtrip.test_json_roundtrip |
633 | Test JSON encode/decode roundtrip. |
| method | TestEncodeDecodeRoundtrip.test_text_roundtrip |
640 | Test text encode/decode roundtrip. |
| method | TestEncodeDecodeRoundtrip.test_binary_roundtrip |
647 | Test binary encode/decode roundtrip. |
| method | TestEncodeDecodeRoundtrip.test_complex_json_roundtrip |
654 | Test complex nested JSON roundtrip. |
| method | TestEncodeDecodeRoundtrip.test_unicode_text_roundtrip |
667 | Test Unicode text roundtrip. |
| method | TestEncodeDecodeRoundtrip.test_empty_json_roundtrip |
676 | Test empty JSON roundtrip. |
| class | TestEdgeCases |
691 | Test edge cases and error conditions. |
| method | TestEdgeCases.test_validate_max_size_boundary |
694 | Validate payload at exact max size boundary. |
| method | TestEdgeCases.test_validate_max_size_plus_one |
703 | Validate payload one byte over max size. |
| method | TestEdgeCases.test_encode_special_json_values |
710 | Encode special JSON values (null, boolean, numbers). |
| method | TestEdgeCases.test_encode_empty_list |
727 | Encode empty list to JSON. |
| method | TestEdgeCases.test_encode_empty_dict |
735 | Encode empty dict to JSON. |
| method | TestEdgeCases.test_encode_empty_string |
743 | Encode empty string to text. |
| method | TestEdgeCases.test_compress_highly_compressible_data |
751 | Compress highly repetitive data. |
| method | TestEdgeCases.test_compress_incompressible_data |
759 | Compress random incompressible data. |
| method | TestEdgeCases.test_validate_zero_size_payload |
772 | Validate zero-size payload is accepted. |
| class | TestIntegration |
786 | Integration tests combining multiple operations. |
| method | TestIntegration.test_full_workflow_json |
789 | Test full workflow: encode, validate, decode. |
| method | TestIntegration.test_full_workflow_compressed |
802 | Test full workflow with compression. |
| method | TestIntegration.test_content_type_auto_detection_workflow |
825 | Test workflow with automatic content type detection. |
| method | TestIntegration.test_multiple_compressions_decompressions |
845 | Test multiple compression/decompression cycles. |
| method | TestIntegration.test_validate_then_compress_workflow |
859 | Test validation before compression workflow. |
| class | TestPerformanceAndSize |
883 | Test performance characteristics and size handling. |
| method | TestPerformanceAndSize.test_large_json_compression_ratio |
886 | Verify large JSON achieves good compression ratio. |
| method | TestPerformanceAndSize.test_small_payload_no_compression_benefit |
897 | Verify small payloads don't benefit from compression. |
| method | TestPerformanceAndSize.test_encode_decode_performance |
907 | Test encode/decode performance with medium-sized data. |
| method | TestPerformanceAndSize.test_compression_decompression_performance |
917 | Test compression/decompression performance. |
| class | TestPayloadEdgeCases |
933 | Cover payload edge cases for 100% coverage. |
| method | TestPayloadEdgeCases.test_create_payload_with_non_bytes_content |
936 | When encode returns a non-bytes value, str() fallback is used (line 185). |
| method | TestPayloadEdgeCases.test_compressed_payload_round_trip |
958 | Compressed payloads survive full create_payload -> decode cycle. |
| method | TestPayloadEdgeCases.test_compressed_text_round_trip |
975 | Text data survives compress -> decompress round trip through MessagePayload. |
| method | TestPayloadEdgeCases.test_uncompressed_payload_has_compressed_false |
989 | create_payload without compress=True produces compressed=False (the default). |
| method | TestPayloadEdgeCases.test_create_payload_size_bytes_matches_content_length |
996 | size_bytes is the real UTF-8 byte length of content, not left at 0. |
| method | TestPayloadEdgeCases.test_message_payload_to_dict_from_dict_round_trip_compressed_and_size |
1004 | Restored fields round-trip through MessagePayload.to_dict()/from_dict() directly. |
| method | TestPayloadEdgeCases.test_message_payload_size_bytes_auto_computed_when_omitted |
1021 | MessagePayload.post_init is the real producer: size_bytes fills itself in. |