@typespec/http-client-python 0.28.1 → 0.28.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/emitter/code-model.d.ts.map +1 -1
- package/dist/emitter/code-model.js +6 -6
- package/dist/emitter/code-model.js.map +1 -1
- package/dist/emitter/emitter.d.ts.map +1 -1
- package/dist/emitter/emitter.js +27 -28
- package/dist/emitter/emitter.js.map +1 -1
- package/dist/emitter/lib.d.ts +4 -1
- package/dist/emitter/lib.d.ts.map +1 -1
- package/dist/emitter/lib.js.map +1 -1
- package/dist/emitter/system-requirements.js +6 -4
- package/dist/emitter/system-requirements.js.map +1 -1
- package/dist/emitter/types.d.ts +2 -5
- package/dist/emitter/types.d.ts.map +1 -1
- package/dist/emitter/types.js +55 -58
- package/dist/emitter/types.js.map +1 -1
- package/dist/emitter/utils.d.ts.map +1 -1
- package/dist/emitter/utils.js +16 -17
- package/dist/emitter/utils.js.map +1 -1
- package/emitter/src/code-model.ts +6 -13
- package/emitter/src/emitter.ts +29 -31
- package/emitter/src/lib.ts +4 -0
- package/emitter/src/system-requirements.ts +4 -4
- package/emitter/src/types.ts +67 -57
- package/emitter/src/utils.ts +16 -18
- package/emitter/temp/tsconfig.tsbuildinfo +1 -1
- package/eng/scripts/Build-Packages.ps1 +62 -37
- package/eng/scripts/Check-GitChanges.ps1 +30 -3
- package/eng/scripts/Functions.ps1 +54 -15
- package/eng/scripts/Generate.ps1 +42 -8
- package/eng/scripts/Generation.psm1 +44 -15
- package/eng/scripts/Initialize-Repository.ps1 +29 -11
- package/eng/scripts/Test-Packages.ps1 +47 -31
- package/eng/scripts/ci/config/eslint-ci.config.mjs +54 -0
- package/eng/scripts/ci/dev_requirements.txt +1 -0
- package/eng/scripts/ci/format.ts +232 -2
- package/eng/scripts/ci/lint.ts +216 -20
- package/eng/scripts/ci/regenerate-common.ts +18 -14
- package/eng/scripts/ci/regenerate.ts +305 -68
- package/eng/scripts/ci/run-tests.ts +402 -0
- package/eng/scripts/ci/run_mypy.py +4 -3
- package/eng/scripts/ci/run_pylint.py +4 -3
- package/eng/scripts/ci/run_pyright.py +4 -3
- package/eng/scripts/ci/typecheck.ts +225 -0
- package/eng/scripts/ci/util.py +1 -1
- package/eng/scripts/ci/utils.ts +5 -5
- package/eng/scripts/setup/__pycache__/package_manager.cpython-311.pyc +0 -0
- package/eng/scripts/setup/__pycache__/venvtools.cpython-311.pyc +0 -0
- package/eng/scripts/setup/build.ts +1 -1
- package/eng/scripts/setup/build_pygen_wheel.py +1 -0
- package/eng/scripts/setup/install.py +1 -0
- package/eng/scripts/setup/prepare.py +1 -0
- package/eng/scripts/setup/prepare.ts +1 -1
- package/eng/scripts/setup/run_tsp.py +3 -3
- package/eng/scripts/setup/system-requirements.ts +8 -4
- package/eng/scripts/setup/venvtools.py +1 -0
- package/generator/build/lib/pygen/codegen/models/operation.py +9 -8
- package/generator/build/lib/pygen/codegen/templates/model_base.py.jinja2 +157 -64
- package/generator/dist/pygen-0.1.0-py3-none-any.whl +0 -0
- package/generator/pygen/codegen/models/operation.py +9 -8
- package/generator/pygen/codegen/templates/model_base.py.jinja2 +157 -64
- package/package.json +48 -42
- package/eng/scripts/ci/run-ci.ts +0 -89
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_commonproperties_async.py +0 -94
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_largeheader_async.py +0 -30
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_nonresource_async.py +0 -36
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_operationtemplates_async.py +0 -205
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_resource_async.py +0 -478
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_access_async.py +0 -101
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_api_version_header_async.py +0 -18
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_api_version_path_async.py +0 -18
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_api_version_query_async.py +0 -18
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_client_default_value_async.py +0 -46
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_client_initialization_async.py +0 -58
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_client_location_async.py +0 -82
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_deserialize_empty_string_as_null_async.py +0 -20
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_flatten_async.py +0 -115
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_hierrarchy_building_async.py +0 -53
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_next_link_verb_async.py +0 -28
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_override_async.py +0 -106
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_usage_async.py +0 -38
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_basic_async.py +0 -76
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_lro_rpc_async.py +0 -22
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_lro_standard_async.py +0 -39
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_model_async.py +0 -33
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_page_async.py +0 -80
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_scalar_async.py +0 -41
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_traits_async.py +0 -87
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_encode_duration_async.py +0 -19
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_example_basic_async.py +0 -30
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_payload_pageable_async.py +0 -19
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_resource_manager_method_subscription_id_async.py +0 -248
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_resource_manager_multi_service_async.py +0 -110
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_resource_manager_multi_service_shared_models_async.py +0 -132
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_special_headers_client_request_id_async.py +0 -30
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_versioning_previewversion_async.py +0 -53
- package/generator/test/azure/mock_api_tests/asynctests/test_client_namespace_async.py +0 -34
- package/generator/test/azure/mock_api_tests/asynctests/test_client_naming_async.py +0 -69
- package/generator/test/azure/mock_api_tests/asynctests/test_client_naming_enum_conflict_async.py +0 -37
- package/generator/test/azure/mock_api_tests/asynctests/test_client_overload_async.py +0 -27
- package/generator/test/azure/mock_api_tests/asynctests/test_client_structure_async.py +0 -64
- package/generator/test/azure/mock_api_tests/asynctests/test_client_structure_clientoperationgroup_async.py +0 -31
- package/generator/test/azure/mock_api_tests/asynctests/test_encode_duration_async.py +0 -63
- package/generator/test/azure/mock_api_tests/asynctests/test_encode_numeric_async.py +0 -35
- package/generator/test/azure/mock_api_tests/asynctests/test_parameters_basic_async.py +0 -24
- package/generator/test/azure/mock_api_tests/asynctests/test_parameters_spread_async.py +0 -76
- package/generator/test/azure/mock_api_tests/asynctests/test_payload_content_negotiation_async.py +0 -37
- package/generator/test/azure/mock_api_tests/asynctests/test_payload_multipart_async.py +0 -216
- package/generator/test/azure/mock_api_tests/asynctests/test_resiliency_srv_driven_async.py +0 -130
- package/generator/test/azure/mock_api_tests/asynctests/test_serialization_encoded_name_json_async.py +0 -24
- package/generator/test/azure/mock_api_tests/asynctests/test_service_multi_service_async.py +0 -31
- package/generator/test/azure/mock_api_tests/asynctests/test_special_words_async.py +0 -71
- package/generator/test/azure/mock_api_tests/conftest.py +0 -207
- package/generator/test/azure/mock_api_tests/data/image.jpg +0 -0
- package/generator/test/azure/mock_api_tests/data/image.png +0 -0
- package/generator/test/azure/mock_api_tests/test_azure_arm_commonproperties.py +0 -89
- package/generator/test/azure/mock_api_tests/test_azure_arm_largeheader.py +0 -27
- package/generator/test/azure/mock_api_tests/test_azure_arm_nonresource.py +0 -34
- package/generator/test/azure/mock_api_tests/test_azure_arm_operationtemplates.py +0 -180
- package/generator/test/azure/mock_api_tests/test_azure_arm_resource.py +0 -436
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_access.py +0 -92
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_api_version_header.py +0 -17
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_api_version_path.py +0 -17
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_api_version_query.py +0 -17
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_client_default_value.py +0 -42
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_client_initialization.py +0 -51
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_client_location.py +0 -70
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_deserialize_empty_string_as_null.py +0 -19
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_flatten.py +0 -104
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_hierrarchy_building.py +0 -45
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_next_link_verb.py +0 -27
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_override.py +0 -102
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_usage.py +0 -32
- package/generator/test/azure/mock_api_tests/test_azure_core_basic.py +0 -70
- package/generator/test/azure/mock_api_tests/test_azure_core_lro_rpc.py +0 -20
- package/generator/test/azure/mock_api_tests/test_azure_core_lro_standard.py +0 -32
- package/generator/test/azure/mock_api_tests/test_azure_core_model.py +0 -30
- package/generator/test/azure/mock_api_tests/test_azure_core_page.py +0 -71
- package/generator/test/azure/mock_api_tests/test_azure_core_scalar.py +0 -35
- package/generator/test/azure/mock_api_tests/test_azure_core_traits.py +0 -85
- package/generator/test/azure/mock_api_tests/test_azure_encode_duration.py +0 -18
- package/generator/test/azure/mock_api_tests/test_azure_example_basic.py +0 -29
- package/generator/test/azure/mock_api_tests/test_azure_payload_pageable.py +0 -18
- package/generator/test/azure/mock_api_tests/test_azure_resource_manager_method_subscription_id.py +0 -235
- package/generator/test/azure/mock_api_tests/test_azure_resource_manager_multi_service.py +0 -104
- package/generator/test/azure/mock_api_tests/test_azure_resource_manager_multi_service_shared_models.py +0 -128
- package/generator/test/azure/mock_api_tests/test_azure_special_headers_client_request_id.py +0 -29
- package/generator/test/azure/mock_api_tests/test_azure_versioning_previewversion.py +0 -50
- package/generator/test/azure/mock_api_tests/test_clear_output_folder.py +0 -23
- package/generator/test/azure/mock_api_tests/test_client_namespace.py +0 -32
- package/generator/test/azure/mock_api_tests/test_client_naming.py +0 -57
- package/generator/test/azure/mock_api_tests/test_client_naming_enum_conflict.py +0 -35
- package/generator/test/azure/mock_api_tests/test_client_overload.py +0 -25
- package/generator/test/azure/mock_api_tests/test_client_structure.py +0 -60
- package/generator/test/azure/mock_api_tests/test_client_structure_clientoperationgroup.py +0 -29
- package/generator/test/azure/mock_api_tests/test_encode_duration.py +0 -60
- package/generator/test/azure/mock_api_tests/test_encode_numeric.py +0 -31
- package/generator/test/azure/mock_api_tests/test_model_base_flatten_compatibility.py +0 -251
- package/generator/test/azure/mock_api_tests/test_parameters_basic.py +0 -22
- package/generator/test/azure/mock_api_tests/test_parameters_spread.py +0 -66
- package/generator/test/azure/mock_api_tests/test_payload_content_negotiation.py +0 -33
- package/generator/test/azure/mock_api_tests/test_payload_multipart.py +0 -198
- package/generator/test/azure/mock_api_tests/test_resiliency_srv_driven.py +0 -124
- package/generator/test/azure/mock_api_tests/test_serialization_encoded_name_json.py +0 -21
- package/generator/test/azure/mock_api_tests/test_service_multi_service.py +0 -29
- package/generator/test/azure/mock_api_tests/test_special_words.py +0 -63
- package/generator/test/azure/requirements.txt +0 -125
- package/generator/test/azure/tox.ini +0 -64
- package/generator/test/data/image.jpg +0 -0
- package/generator/test/data/image.png +0 -0
- package/generator/test/dev_requirements.txt +0 -8
- package/generator/test/generic_mock_api_tests/asynctests/test_authentication_async.py +0 -140
- package/generator/test/generic_mock_api_tests/asynctests/test_encode_array_async.py +0 -139
- package/generator/test/generic_mock_api_tests/asynctests/test_encode_bytes_async.py +0 -132
- package/generator/test/generic_mock_api_tests/asynctests/test_encode_datetime_async.py +0 -127
- package/generator/test/generic_mock_api_tests/asynctests/test_headasboolean_async.py +0 -35
- package/generator/test/generic_mock_api_tests/asynctests/test_parameters_body_optionality_async.py +0 -30
- package/generator/test/generic_mock_api_tests/asynctests/test_parameters_collection_format_async.py +0 -38
- package/generator/test/generic_mock_api_tests/asynctests/test_parameters_path_async.py +0 -24
- package/generator/test/generic_mock_api_tests/asynctests/test_parameters_query_async.py +0 -18
- package/generator/test/generic_mock_api_tests/asynctests/test_payload_json_merge_patch_async.py +0 -98
- package/generator/test/generic_mock_api_tests/asynctests/test_payload_media_type_async.py +0 -27
- package/generator/test/generic_mock_api_tests/asynctests/test_payload_pageable_async.py +0 -134
- package/generator/test/generic_mock_api_tests/asynctests/test_payload_xml_async.py +0 -150
- package/generator/test/generic_mock_api_tests/asynctests/test_response_status_code_range_async.py +0 -38
- package/generator/test/generic_mock_api_tests/asynctests/test_routes_async.py +0 -331
- package/generator/test/generic_mock_api_tests/asynctests/test_server_endpoint_not_defined_async.py +0 -18
- package/generator/test/generic_mock_api_tests/asynctests/test_server_path_multiple_async.py +0 -25
- package/generator/test/generic_mock_api_tests/asynctests/test_server_path_single_async.py +0 -18
- package/generator/test/generic_mock_api_tests/asynctests/test_server_versions_not_versioned_async.py +0 -28
- package/generator/test/generic_mock_api_tests/asynctests/test_server_versions_versioned_async.py +0 -34
- package/generator/test/generic_mock_api_tests/asynctests/test_special_headers_conditional_request_async.py +0 -38
- package/generator/test/generic_mock_api_tests/asynctests/test_special_headers_repeatability_async.py +0 -19
- package/generator/test/generic_mock_api_tests/asynctests/test_specs_documentation_async.py +0 -59
- package/generator/test/generic_mock_api_tests/asynctests/test_streaming_jsonl_async.py +0 -27
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_array_async.py +0 -127
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_dictionary_async.py +0 -98
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_enum_extensible_async.py +0 -25
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_enum_fixed_async.py +0 -27
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_file_async.py +0 -59
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_empty_async.py +0 -32
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_enum_discriminator_async.py +0 -70
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_nested_discriminator_async.py +0 -85
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_not_discriminated_async.py +0 -34
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_recursive_async.py +0 -34
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_single_discriminator_async.py +0 -67
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_usage_async.py +0 -32
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_visibility_async.py +0 -47
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_property_additionalproperties_async.py +0 -353
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_property_nullable_async.py +0 -110
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_property_optional_async.py +0 -197
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_property_valuetypes_async.py +0 -315
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_scalar_async.py +0 -60
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_union_async.py +0 -90
- package/generator/test/generic_mock_api_tests/asynctests/test_versioning_added_async.py +0 -36
- package/generator/test/generic_mock_api_tests/asynctests/test_versioning_made_optional_async.py +0 -21
- package/generator/test/generic_mock_api_tests/asynctests/test_versioning_removed_async.py +0 -39
- package/generator/test/generic_mock_api_tests/asynctests/test_versioning_renamed_from_async.py +0 -29
- package/generator/test/generic_mock_api_tests/asynctests/test_versioning_return_type_changed_from_async.py +0 -18
- package/generator/test/generic_mock_api_tests/asynctests/test_versioning_type_changed_from_async.py +0 -22
- package/generator/test/generic_mock_api_tests/conftest.py +0 -75
- package/generator/test/generic_mock_api_tests/data/image.jpg +0 -0
- package/generator/test/generic_mock_api_tests/data/image.png +0 -0
- package/generator/test/generic_mock_api_tests/test_authentication.py +0 -130
- package/generator/test/generic_mock_api_tests/test_encode_array.py +0 -126
- package/generator/test/generic_mock_api_tests/test_encode_bytes.py +0 -128
- package/generator/test/generic_mock_api_tests/test_encode_datetime.py +0 -123
- package/generator/test/generic_mock_api_tests/test_headasboolean.py +0 -33
- package/generator/test/generic_mock_api_tests/test_parameters_body_optionality.py +0 -27
- package/generator/test/generic_mock_api_tests/test_parameters_collection_format.py +0 -33
- package/generator/test/generic_mock_api_tests/test_parameters_path.py +0 -22
- package/generator/test/generic_mock_api_tests/test_parameters_query.py +0 -17
- package/generator/test/generic_mock_api_tests/test_payload_json_merge_patch.py +0 -93
- package/generator/test/generic_mock_api_tests/test_payload_media_type.py +0 -25
- package/generator/test/generic_mock_api_tests/test_payload_pageable.py +0 -99
- package/generator/test/generic_mock_api_tests/test_payload_xml.py +0 -135
- package/generator/test/generic_mock_api_tests/test_response_status_code_range.py +0 -36
- package/generator/test/generic_mock_api_tests/test_routes.py +0 -285
- package/generator/test/generic_mock_api_tests/test_server_endpoint_not_defined.py +0 -17
- package/generator/test/generic_mock_api_tests/test_server_path_multiple.py +0 -21
- package/generator/test/generic_mock_api_tests/test_server_path_single.py +0 -17
- package/generator/test/generic_mock_api_tests/test_server_versions_not_versioned.py +0 -25
- package/generator/test/generic_mock_api_tests/test_server_versions_versioned.py +0 -30
- package/generator/test/generic_mock_api_tests/test_special_headers_conditional_request.py +0 -34
- package/generator/test/generic_mock_api_tests/test_special_headers_repeatability.py +0 -18
- package/generator/test/generic_mock_api_tests/test_specs_documentation.py +0 -51
- package/generator/test/generic_mock_api_tests/test_streaming_jsonl.py +0 -25
- package/generator/test/generic_mock_api_tests/test_typetest_array.py +0 -111
- package/generator/test/generic_mock_api_tests/test_typetest_dictionary.py +0 -86
- package/generator/test/generic_mock_api_tests/test_typetest_enum_extensible.py +0 -23
- package/generator/test/generic_mock_api_tests/test_typetest_enum_fixed.py +0 -25
- package/generator/test/generic_mock_api_tests/test_typetest_file.py +0 -52
- package/generator/test/generic_mock_api_tests/test_typetest_model_empty.py +0 -29
- package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_enum_discriminator.py +0 -58
- package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_nested_discriminator.py +0 -79
- package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_not_discriminated.py +0 -31
- package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_recursive.py +0 -32
- package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_single_discriminator.py +0 -60
- package/generator/test/generic_mock_api_tests/test_typetest_model_usage.py +0 -28
- package/generator/test/generic_mock_api_tests/test_typetest_model_visibility.py +0 -40
- package/generator/test/generic_mock_api_tests/test_typetest_property_additionalproperties.py +0 -314
- package/generator/test/generic_mock_api_tests/test_typetest_property_nullable.py +0 -102
- package/generator/test/generic_mock_api_tests/test_typetest_property_optional.py +0 -174
- package/generator/test/generic_mock_api_tests/test_typetest_property_valuetypes.py +0 -286
- package/generator/test/generic_mock_api_tests/test_typetest_scalar.py +0 -53
- package/generator/test/generic_mock_api_tests/test_typetest_union.py +0 -80
- package/generator/test/generic_mock_api_tests/test_typetest_union_discriminated.py +0 -290
- package/generator/test/generic_mock_api_tests/test_versioning_added.py +0 -33
- package/generator/test/generic_mock_api_tests/test_versioning_made_optional.py +0 -20
- package/generator/test/generic_mock_api_tests/test_versioning_removed.py +0 -37
- package/generator/test/generic_mock_api_tests/test_versioning_renamed_from.py +0 -27
- package/generator/test/generic_mock_api_tests/test_versioning_return_type_changed_from.py +0 -17
- package/generator/test/generic_mock_api_tests/test_versioning_type_changed_from.py +0 -21
- package/generator/test/unbranded/mock_api_tests/asynctests/test_auth_flow_async.py +0 -19
- package/generator/test/unbranded/mock_api_tests/asynctests/test_encode_duration_async.py +0 -63
- package/generator/test/unbranded/mock_api_tests/asynctests/test_encode_numeric_async.py +0 -35
- package/generator/test/unbranded/mock_api_tests/asynctests/test_parameters_basic_async.py +0 -24
- package/generator/test/unbranded/mock_api_tests/asynctests/test_parameters_spread_async.py +0 -76
- package/generator/test/unbranded/mock_api_tests/asynctests/test_payload_content_negotiation_async.py +0 -37
- package/generator/test/unbranded/mock_api_tests/asynctests/test_payload_multipart_async.py +0 -218
- package/generator/test/unbranded/mock_api_tests/asynctests/test_serialization_encoded_name_json_async.py +0 -24
- package/generator/test/unbranded/mock_api_tests/asynctests/test_special_words_async.py +0 -73
- package/generator/test/unbranded/mock_api_tests/asynctests/test_unbranded_async.py +0 -24
- package/generator/test/unbranded/mock_api_tests/conftest.py +0 -91
- package/generator/test/unbranded/mock_api_tests/data/image.jpg +0 -0
- package/generator/test/unbranded/mock_api_tests/data/image.png +0 -0
- package/generator/test/unbranded/mock_api_tests/test_auth_flow.py +0 -17
- package/generator/test/unbranded/mock_api_tests/test_encode_duration.py +0 -60
- package/generator/test/unbranded/mock_api_tests/test_encode_numeric.py +0 -32
- package/generator/test/unbranded/mock_api_tests/test_parameters_basic.py +0 -22
- package/generator/test/unbranded/mock_api_tests/test_parameters_spread.py +0 -66
- package/generator/test/unbranded/mock_api_tests/test_payload_content_negotiation.py +0 -33
- package/generator/test/unbranded/mock_api_tests/test_payload_multipart.py +0 -200
- package/generator/test/unbranded/mock_api_tests/test_serialization_encoded_name_json.py +0 -22
- package/generator/test/unbranded/mock_api_tests/test_special_words.py +0 -66
- package/generator/test/unbranded/mock_api_tests/test_unbranded.py +0 -65
- package/generator/test/unbranded/requirements.txt +0 -69
- package/generator/test/unbranded/tox.ini +0 -64
- package/generator/test/unittests/conftest.py +0 -15
- package/generator/test/unittests/requirements.txt +0 -3
- package/generator/test/unittests/test_enums.py +0 -89
- package/generator/test/unittests/test_model_base_serialization.py +0 -4906
- package/generator/test/unittests/test_model_base_xml_serialization.py +0 -1239
- package/generator/test/unittests/test_name_converter.py +0 -35
- package/generator/test/unittests/test_optional_return_type.py +0 -268
- package/generator/test/unittests/test_parameter_ordering.py +0 -104
- package/generator/test/unittests/test_sort_schema.py +0 -93
- package/generator/test/unittests/tox.ini +0 -5
- /package/eng/scripts/ci/{mypy.ini → config/mypy.ini} +0 -0
- /package/eng/scripts/ci/{pylintrc → config/pylintrc} +0 -0
- /package/eng/scripts/ci/{pyproject.toml → config/pyproject.toml} +0 -0
- /package/eng/scripts/ci/{pyrightconfig.json → config/pyrightconfig.json} +0 -0
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
[tox]
|
|
2
|
-
envlist=base, lint, mypy, pyright, apiview, sphinx
|
|
3
|
-
skipsdist=True
|
|
4
|
-
|
|
5
|
-
[testenv:ci]
|
|
6
|
-
deps=
|
|
7
|
-
-r requirements.txt
|
|
8
|
-
commands =
|
|
9
|
-
# pytest
|
|
10
|
-
{[testenv:test]commands}
|
|
11
|
-
|
|
12
|
-
# pylint
|
|
13
|
-
{[testenv:lint]commands}
|
|
14
|
-
|
|
15
|
-
# mypy
|
|
16
|
-
{[testenv:mypy]commands}
|
|
17
|
-
|
|
18
|
-
# pyright
|
|
19
|
-
{[testenv:pyright]commands}
|
|
20
|
-
|
|
21
|
-
# apiview
|
|
22
|
-
{[testenv:apiview]commands}
|
|
23
|
-
|
|
24
|
-
# sphinx docstring validation
|
|
25
|
-
{[testenv:sphinx]commands}
|
|
26
|
-
|
|
27
|
-
[testenv:test]
|
|
28
|
-
deps=
|
|
29
|
-
-r requirements.txt
|
|
30
|
-
commands =
|
|
31
|
-
pytest mock_api_tests ../generic_mock_api_tests
|
|
32
|
-
|
|
33
|
-
[testenv:lint]
|
|
34
|
-
deps=
|
|
35
|
-
-r requirements.txt
|
|
36
|
-
commands =
|
|
37
|
-
pip install azure-pylint-guidelines-checker==0.5.2 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/"
|
|
38
|
-
python ../../../eng/scripts/ci/run_pylint.py -t azure -s "generated" {posargs}
|
|
39
|
-
|
|
40
|
-
[testenv:mypy]
|
|
41
|
-
deps=
|
|
42
|
-
-r requirements.txt
|
|
43
|
-
commands =
|
|
44
|
-
python ../../../eng/scripts/ci/run_mypy.py -t azure -s "generated" {posargs}
|
|
45
|
-
|
|
46
|
-
[testenv:pyright]
|
|
47
|
-
deps=
|
|
48
|
-
-r requirements.txt
|
|
49
|
-
commands =
|
|
50
|
-
python ../../../eng/scripts/ci/run_pyright.py -t azure -s "generated" {posargs}
|
|
51
|
-
|
|
52
|
-
[testenv:apiview]
|
|
53
|
-
deps=
|
|
54
|
-
-r requirements.txt
|
|
55
|
-
commands =
|
|
56
|
-
pip install apiview-stub-generator==0.3.19 --index-url="https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/"
|
|
57
|
-
python ../../../eng/scripts/ci/run_apiview.py -t azure -s "generated" {posargs}
|
|
58
|
-
|
|
59
|
-
[testenv:sphinx]
|
|
60
|
-
basepython = python3.10
|
|
61
|
-
deps=
|
|
62
|
-
-r requirements.txt
|
|
63
|
-
commands =
|
|
64
|
-
python ../../../eng/scripts/ci/run_sphinx_build.py -t azure -s "generated" {posargs}
|
|
Binary file
|
|
Binary file
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
# -------------------------------------------------------------------------
|
|
2
|
-
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
# Licensed under the MIT License. See License.txt in the project root for
|
|
4
|
-
# license information.
|
|
5
|
-
# --------------------------------------------------------------------------
|
|
6
|
-
import pytest
|
|
7
|
-
from authentication.apikey.aio import ApiKeyClient
|
|
8
|
-
from authentication.http.custom.aio import CustomClient
|
|
9
|
-
from authentication.oauth2.aio import OAuth2Client
|
|
10
|
-
from authentication.union.aio import UnionClient
|
|
11
|
-
from setuppy.authentication.union.aio import UnionClient as SetuppyUnionClient
|
|
12
|
-
from authentication.noauth.union.aio import UnionClient as NoauthUnionClient
|
|
13
|
-
|
|
14
|
-
# Utilities functions
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
@pytest.fixture
|
|
18
|
-
async def api_key_client(key_credential):
|
|
19
|
-
client = None
|
|
20
|
-
|
|
21
|
-
def _build_client(client_type, key: str = "valid-key"):
|
|
22
|
-
client = client_type(key_credential(key))
|
|
23
|
-
return client
|
|
24
|
-
|
|
25
|
-
yield _build_client
|
|
26
|
-
if client:
|
|
27
|
-
await client.close()
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
@pytest.fixture()
|
|
31
|
-
def token_credential(core_library):
|
|
32
|
-
class FakeCredential:
|
|
33
|
-
@staticmethod
|
|
34
|
-
async def get_token(*scopes):
|
|
35
|
-
return core_library.credentials.AccessToken(token="".join(scopes), expires_on=1800)
|
|
36
|
-
|
|
37
|
-
@staticmethod
|
|
38
|
-
async def get_token_info(*scopes, **kwargs):
|
|
39
|
-
return core_library.credentials.AccessTokenInfo(token="".join(scopes), expires_on=1800)
|
|
40
|
-
|
|
41
|
-
return FakeCredential()
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
@pytest.fixture
|
|
45
|
-
async def oauth2_client(token_credential):
|
|
46
|
-
client = None
|
|
47
|
-
|
|
48
|
-
def _build_client(client_type):
|
|
49
|
-
client = client_type(token_credential)
|
|
50
|
-
return client
|
|
51
|
-
|
|
52
|
-
yield _build_client
|
|
53
|
-
if client:
|
|
54
|
-
await client.close()
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
@pytest.fixture
|
|
58
|
-
async def http_custom_client(key_credential):
|
|
59
|
-
client = None
|
|
60
|
-
|
|
61
|
-
def _build_client(key: str = "valid-key"):
|
|
62
|
-
client = CustomClient(key_credential(key))
|
|
63
|
-
return client
|
|
64
|
-
|
|
65
|
-
yield _build_client
|
|
66
|
-
if client:
|
|
67
|
-
await client.close()
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
# Tests
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
@pytest.mark.asyncio
|
|
74
|
-
async def test_api_key_valid(api_key_client):
|
|
75
|
-
client = api_key_client(ApiKeyClient)
|
|
76
|
-
await client.valid()
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
@pytest.mark.asyncio
|
|
80
|
-
async def test_api_key_invalid(api_key_client, core_library):
|
|
81
|
-
client = api_key_client(ApiKeyClient, "invalid-key")
|
|
82
|
-
with pytest.raises(core_library.exceptions.HttpResponseError) as ex:
|
|
83
|
-
await client.invalid()
|
|
84
|
-
assert ex.value.status_code == 403
|
|
85
|
-
assert ex.value.reason == "Forbidden"
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
@pytest.mark.asyncio
|
|
89
|
-
async def test_oauth2_valid(oauth2_client):
|
|
90
|
-
client = oauth2_client(OAuth2Client)
|
|
91
|
-
await client.valid(enforce_https=False)
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
@pytest.mark.asyncio
|
|
95
|
-
async def test_oauth2_invalid(oauth2_client, core_library):
|
|
96
|
-
client = oauth2_client(OAuth2Client)
|
|
97
|
-
with pytest.raises(core_library.exceptions.HttpResponseError) as ex:
|
|
98
|
-
await client.invalid(enforce_https=False)
|
|
99
|
-
assert ex.value.status_code == 403
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
@pytest.mark.asyncio
|
|
103
|
-
@pytest.mark.parametrize("union_client_type", [UnionClient, SetuppyUnionClient])
|
|
104
|
-
async def test_union_keyvalid(api_key_client, union_client_type):
|
|
105
|
-
client = api_key_client(union_client_type)
|
|
106
|
-
await client.valid_key()
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
@pytest.mark.asyncio
|
|
110
|
-
@pytest.mark.parametrize("union_client_type", [UnionClient, SetuppyUnionClient])
|
|
111
|
-
async def test_union_tokenvalid(oauth2_client, union_client_type):
|
|
112
|
-
client = oauth2_client(union_client_type)
|
|
113
|
-
await client.valid_token(enforce_https=False)
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
@pytest.mark.asyncio
|
|
117
|
-
async def test_noauth_union_valid_no_auth():
|
|
118
|
-
client = NoauthUnionClient()
|
|
119
|
-
await client.valid_no_auth()
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
@pytest.mark.asyncio
|
|
123
|
-
async def test_noauth_union_valid_token(oauth2_client):
|
|
124
|
-
client = oauth2_client(NoauthUnionClient)
|
|
125
|
-
await client.valid_token(enforce_https=False)
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
@pytest.mark.asyncio
|
|
129
|
-
async def test_http_custom_valid(http_custom_client):
|
|
130
|
-
client = http_custom_client()
|
|
131
|
-
await client.valid()
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
@pytest.mark.asyncio
|
|
135
|
-
async def test_http_custom_invalid(http_custom_client, core_library):
|
|
136
|
-
client = http_custom_client(key="invalid-key")
|
|
137
|
-
with pytest.raises(core_library.exceptions.HttpResponseError) as ex:
|
|
138
|
-
await client.invalid()
|
|
139
|
-
assert ex.value.status_code == 403
|
|
140
|
-
assert ex.value.reason == "Forbidden"
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
# -------------------------------------------------------------------------
|
|
2
|
-
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
# Licensed under the MIT License. See License.txt in the project root for
|
|
4
|
-
# license information.
|
|
5
|
-
# --------------------------------------------------------------------------
|
|
6
|
-
|
|
7
|
-
import pytest
|
|
8
|
-
from encode.array.aio import ArrayClient
|
|
9
|
-
from encode.array import models
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
@pytest.fixture
|
|
13
|
-
async def client():
|
|
14
|
-
async with ArrayClient() as client:
|
|
15
|
-
yield client
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
@pytest.mark.asyncio
|
|
19
|
-
async def test_comma_delimited(client: ArrayClient):
|
|
20
|
-
body = models.CommaDelimitedArrayProperty(value=["blue", "red", "green"])
|
|
21
|
-
result = await client.property.comma_delimited(body)
|
|
22
|
-
assert result.value == ["blue", "red", "green"]
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
@pytest.mark.asyncio
|
|
26
|
-
async def test_space_delimited(client: ArrayClient):
|
|
27
|
-
body = models.SpaceDelimitedArrayProperty(value=["blue", "red", "green"])
|
|
28
|
-
result = await client.property.space_delimited(body)
|
|
29
|
-
assert result.value == ["blue", "red", "green"]
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
@pytest.mark.asyncio
|
|
33
|
-
async def test_pipe_delimited(client: ArrayClient):
|
|
34
|
-
body = models.PipeDelimitedArrayProperty(value=["blue", "red", "green"])
|
|
35
|
-
result = await client.property.pipe_delimited(body)
|
|
36
|
-
assert result.value == ["blue", "red", "green"]
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
@pytest.mark.asyncio
|
|
40
|
-
async def test_newline_delimited(client: ArrayClient):
|
|
41
|
-
body = models.NewlineDelimitedArrayProperty(value=["blue", "red", "green"])
|
|
42
|
-
result = await client.property.newline_delimited(body)
|
|
43
|
-
assert result.value == ["blue", "red", "green"]
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
@pytest.mark.asyncio
|
|
47
|
-
async def test_enum_comma_delimited(client: ArrayClient):
|
|
48
|
-
body = models.CommaDelimitedEnumArrayProperty(value=[models.Colors.BLUE, models.Colors.RED, models.Colors.GREEN])
|
|
49
|
-
result = await client.property.enum_comma_delimited(body)
|
|
50
|
-
assert result.value == [models.Colors.BLUE, models.Colors.RED, models.Colors.GREEN]
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
@pytest.mark.asyncio
|
|
54
|
-
async def test_enum_space_delimited(client: ArrayClient):
|
|
55
|
-
body = models.SpaceDelimitedEnumArrayProperty(value=[models.Colors.BLUE, models.Colors.RED, models.Colors.GREEN])
|
|
56
|
-
result = await client.property.enum_space_delimited(body)
|
|
57
|
-
assert result.value == [models.Colors.BLUE, models.Colors.RED, models.Colors.GREEN]
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
@pytest.mark.asyncio
|
|
61
|
-
async def test_enum_pipe_delimited(client: ArrayClient):
|
|
62
|
-
body = models.PipeDelimitedEnumArrayProperty(value=[models.Colors.BLUE, models.Colors.RED, models.Colors.GREEN])
|
|
63
|
-
result = await client.property.enum_pipe_delimited(body)
|
|
64
|
-
assert result.value == [models.Colors.BLUE, models.Colors.RED, models.Colors.GREEN]
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
@pytest.mark.asyncio
|
|
68
|
-
async def test_enum_newline_delimited(client: ArrayClient):
|
|
69
|
-
body = models.NewlineDelimitedEnumArrayProperty(value=[models.Colors.BLUE, models.Colors.RED, models.Colors.GREEN])
|
|
70
|
-
result = await client.property.enum_newline_delimited(body)
|
|
71
|
-
assert result.value == [models.Colors.BLUE, models.Colors.RED, models.Colors.GREEN]
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
@pytest.mark.asyncio
|
|
75
|
-
async def test_extensible_enum_comma_delimited(client: ArrayClient):
|
|
76
|
-
body = models.CommaDelimitedExtensibleEnumArrayProperty(
|
|
77
|
-
value=[
|
|
78
|
-
models.ColorsExtensibleEnum.BLUE,
|
|
79
|
-
models.ColorsExtensibleEnum.RED,
|
|
80
|
-
models.ColorsExtensibleEnum.GREEN,
|
|
81
|
-
]
|
|
82
|
-
)
|
|
83
|
-
result = await client.property.extensible_enum_comma_delimited(body)
|
|
84
|
-
assert result.value == [
|
|
85
|
-
models.ColorsExtensibleEnum.BLUE,
|
|
86
|
-
models.ColorsExtensibleEnum.RED,
|
|
87
|
-
models.ColorsExtensibleEnum.GREEN,
|
|
88
|
-
]
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
@pytest.mark.asyncio
|
|
92
|
-
async def test_extensible_enum_space_delimited(client: ArrayClient):
|
|
93
|
-
body = models.SpaceDelimitedExtensibleEnumArrayProperty(
|
|
94
|
-
value=[
|
|
95
|
-
models.ColorsExtensibleEnum.BLUE,
|
|
96
|
-
models.ColorsExtensibleEnum.RED,
|
|
97
|
-
models.ColorsExtensibleEnum.GREEN,
|
|
98
|
-
]
|
|
99
|
-
)
|
|
100
|
-
result = await client.property.extensible_enum_space_delimited(body)
|
|
101
|
-
assert result.value == [
|
|
102
|
-
models.ColorsExtensibleEnum.BLUE,
|
|
103
|
-
models.ColorsExtensibleEnum.RED,
|
|
104
|
-
models.ColorsExtensibleEnum.GREEN,
|
|
105
|
-
]
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
@pytest.mark.asyncio
|
|
109
|
-
async def test_extensible_enum_pipe_delimited(client: ArrayClient):
|
|
110
|
-
body = models.PipeDelimitedExtensibleEnumArrayProperty(
|
|
111
|
-
value=[
|
|
112
|
-
models.ColorsExtensibleEnum.BLUE,
|
|
113
|
-
models.ColorsExtensibleEnum.RED,
|
|
114
|
-
models.ColorsExtensibleEnum.GREEN,
|
|
115
|
-
]
|
|
116
|
-
)
|
|
117
|
-
result = await client.property.extensible_enum_pipe_delimited(body)
|
|
118
|
-
assert result.value == [
|
|
119
|
-
models.ColorsExtensibleEnum.BLUE,
|
|
120
|
-
models.ColorsExtensibleEnum.RED,
|
|
121
|
-
models.ColorsExtensibleEnum.GREEN,
|
|
122
|
-
]
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
@pytest.mark.asyncio
|
|
126
|
-
async def test_extensible_enum_newline_delimited(client: ArrayClient):
|
|
127
|
-
body = models.NewlineDelimitedExtensibleEnumArrayProperty(
|
|
128
|
-
value=[
|
|
129
|
-
models.ColorsExtensibleEnum.BLUE,
|
|
130
|
-
models.ColorsExtensibleEnum.RED,
|
|
131
|
-
models.ColorsExtensibleEnum.GREEN,
|
|
132
|
-
]
|
|
133
|
-
)
|
|
134
|
-
result = await client.property.extensible_enum_newline_delimited(body)
|
|
135
|
-
assert result.value == [
|
|
136
|
-
models.ColorsExtensibleEnum.BLUE,
|
|
137
|
-
models.ColorsExtensibleEnum.RED,
|
|
138
|
-
models.ColorsExtensibleEnum.GREEN,
|
|
139
|
-
]
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
# -------------------------------------------------------------------------
|
|
2
|
-
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
# Licensed under the MIT License. See License.txt in the project root for
|
|
4
|
-
# license information.
|
|
5
|
-
# --------------------------------------------------------------------------
|
|
6
|
-
import pytest
|
|
7
|
-
from pathlib import Path
|
|
8
|
-
from encode.bytes.aio import BytesClient
|
|
9
|
-
from encode.bytes.models import (
|
|
10
|
-
DefaultBytesProperty,
|
|
11
|
-
Base64urlBytesProperty,
|
|
12
|
-
Base64BytesProperty,
|
|
13
|
-
Base64urlArrayBytesProperty,
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
FILE_FOLDER = Path(__file__).parent.parent
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
@pytest.fixture
|
|
20
|
-
async def client():
|
|
21
|
-
async with BytesClient() as client:
|
|
22
|
-
yield client
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
@pytest.mark.asyncio
|
|
26
|
-
async def test_query(client: BytesClient):
|
|
27
|
-
await client.query.default(
|
|
28
|
-
value=bytes("test", "utf-8"),
|
|
29
|
-
)
|
|
30
|
-
await client.query.base64(
|
|
31
|
-
value=bytes("test", "utf-8"),
|
|
32
|
-
)
|
|
33
|
-
await client.query.base64_url(
|
|
34
|
-
value=bytes("test", "utf-8"),
|
|
35
|
-
)
|
|
36
|
-
await client.query.base64_url_array(
|
|
37
|
-
value=[
|
|
38
|
-
bytes("test", "utf-8"),
|
|
39
|
-
bytes("test", "utf-8"),
|
|
40
|
-
],
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
@pytest.mark.asyncio
|
|
45
|
-
async def test_property(client: BytesClient):
|
|
46
|
-
result = await client.property.default(
|
|
47
|
-
DefaultBytesProperty(
|
|
48
|
-
value=bytes("test", "utf-8"),
|
|
49
|
-
)
|
|
50
|
-
)
|
|
51
|
-
assert result.value == bytes("test", "utf-8")
|
|
52
|
-
|
|
53
|
-
result = await client.property.base64(
|
|
54
|
-
Base64BytesProperty(
|
|
55
|
-
value=bytes("test", "utf-8"),
|
|
56
|
-
)
|
|
57
|
-
)
|
|
58
|
-
assert result.value == bytes("test", "utf-8")
|
|
59
|
-
|
|
60
|
-
result = await client.property.base64_url(
|
|
61
|
-
Base64urlBytesProperty(
|
|
62
|
-
value=bytes("test", "utf-8"),
|
|
63
|
-
)
|
|
64
|
-
)
|
|
65
|
-
assert result.value == bytes("test", "utf-8")
|
|
66
|
-
|
|
67
|
-
result = await client.property.base64_url_array(
|
|
68
|
-
Base64urlArrayBytesProperty(
|
|
69
|
-
value=[
|
|
70
|
-
bytes("test", "utf-8"),
|
|
71
|
-
bytes("test", "utf-8"),
|
|
72
|
-
],
|
|
73
|
-
)
|
|
74
|
-
)
|
|
75
|
-
assert result.value == [
|
|
76
|
-
bytes("test", "utf-8"),
|
|
77
|
-
bytes("test", "utf-8"),
|
|
78
|
-
]
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
@pytest.mark.asyncio
|
|
82
|
-
async def test_header(client: BytesClient):
|
|
83
|
-
await client.header.default(
|
|
84
|
-
value=bytes("test", "utf-8"),
|
|
85
|
-
)
|
|
86
|
-
await client.header.base64(
|
|
87
|
-
value=bytes("test", "utf-8"),
|
|
88
|
-
)
|
|
89
|
-
await client.header.base64_url(
|
|
90
|
-
value=bytes("test", "utf-8"),
|
|
91
|
-
)
|
|
92
|
-
await client.header.base64_url_array(
|
|
93
|
-
value=[
|
|
94
|
-
bytes("test", "utf-8"),
|
|
95
|
-
bytes("test", "utf-8"),
|
|
96
|
-
],
|
|
97
|
-
)
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
@pytest.fixture
|
|
101
|
-
def png_data() -> bytes:
|
|
102
|
-
with open(str(FILE_FOLDER / "data/image.png"), "rb") as file_in:
|
|
103
|
-
return file_in.read()
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
@pytest.mark.asyncio
|
|
107
|
-
async def test_request_body(client: BytesClient, png_data: bytes):
|
|
108
|
-
await client.request_body.default(
|
|
109
|
-
value=png_data,
|
|
110
|
-
)
|
|
111
|
-
await client.request_body.octet_stream(
|
|
112
|
-
value=png_data,
|
|
113
|
-
)
|
|
114
|
-
await client.request_body.custom_content_type(
|
|
115
|
-
value=png_data,
|
|
116
|
-
)
|
|
117
|
-
await client.request_body.base64(
|
|
118
|
-
value=bytes("test", "utf-8"),
|
|
119
|
-
)
|
|
120
|
-
await client.request_body.base64_url(
|
|
121
|
-
value=bytes("test", "utf-8"),
|
|
122
|
-
)
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
@pytest.mark.asyncio
|
|
126
|
-
async def test_response_body(client: BytesClient, png_data: bytes):
|
|
127
|
-
expected = b"test"
|
|
128
|
-
assert b"".join([d async for d in (await client.response_body.default())]) == png_data
|
|
129
|
-
assert expected == await client.response_body.base64()
|
|
130
|
-
assert b"".join([d async for d in (await client.response_body.octet_stream())]) == png_data
|
|
131
|
-
assert b"".join([d async for d in (await client.response_body.custom_content_type())]) == png_data
|
|
132
|
-
assert expected == await client.response_body.base64_url()
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
# -------------------------------------------------------------------------
|
|
2
|
-
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
# Licensed under the MIT License. See License.txt in the project root for
|
|
4
|
-
# license information.
|
|
5
|
-
# --------------------------------------------------------------------------
|
|
6
|
-
import datetime
|
|
7
|
-
|
|
8
|
-
import pytest
|
|
9
|
-
from encode.datetime.aio import DatetimeClient
|
|
10
|
-
from encode.datetime.models import (
|
|
11
|
-
DefaultDatetimeProperty,
|
|
12
|
-
Rfc3339DatetimeProperty,
|
|
13
|
-
Rfc7231DatetimeProperty,
|
|
14
|
-
UnixTimestampDatetimeProperty,
|
|
15
|
-
UnixTimestampArrayDatetimeProperty,
|
|
16
|
-
)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
@pytest.fixture
|
|
20
|
-
async def client():
|
|
21
|
-
async with DatetimeClient() as client:
|
|
22
|
-
yield client
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
@pytest.mark.asyncio
|
|
26
|
-
async def test_query(client: DatetimeClient):
|
|
27
|
-
await client.query.default(
|
|
28
|
-
value=datetime.datetime(2022, 8, 26, 18, 38, 0, tzinfo=datetime.timezone.utc),
|
|
29
|
-
)
|
|
30
|
-
await client.query.rfc3339(
|
|
31
|
-
value=datetime.datetime(2022, 8, 26, 18, 38, 0, tzinfo=datetime.timezone.utc),
|
|
32
|
-
)
|
|
33
|
-
await client.query.rfc7231(
|
|
34
|
-
value=datetime.datetime(2022, 8, 26, 14, 38, 0, tzinfo=datetime.timezone.utc),
|
|
35
|
-
)
|
|
36
|
-
await client.query.unix_timestamp(
|
|
37
|
-
value=datetime.datetime(2023, 6, 12, 10, 47, 44, tzinfo=datetime.timezone.utc),
|
|
38
|
-
)
|
|
39
|
-
await client.query.unix_timestamp_array(
|
|
40
|
-
value=[
|
|
41
|
-
datetime.datetime(2023, 6, 12, 10, 47, 44, tzinfo=datetime.timezone.utc),
|
|
42
|
-
datetime.datetime(2023, 6, 14, 9, 17, 36, tzinfo=datetime.timezone.utc),
|
|
43
|
-
],
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
@pytest.mark.asyncio
|
|
48
|
-
async def test_property(client: DatetimeClient):
|
|
49
|
-
result = await client.property.default(
|
|
50
|
-
DefaultDatetimeProperty(
|
|
51
|
-
value=datetime.datetime(2022, 8, 26, 18, 38, 0, tzinfo=datetime.timezone.utc),
|
|
52
|
-
)
|
|
53
|
-
)
|
|
54
|
-
assert result.value == datetime.datetime(2022, 8, 26, 18, 38, 0, tzinfo=datetime.timezone.utc)
|
|
55
|
-
|
|
56
|
-
result = await client.property.rfc3339(
|
|
57
|
-
Rfc3339DatetimeProperty(
|
|
58
|
-
value=datetime.datetime(2022, 8, 26, 18, 38, 0, tzinfo=datetime.timezone.utc),
|
|
59
|
-
)
|
|
60
|
-
)
|
|
61
|
-
assert result.value == datetime.datetime(2022, 8, 26, 18, 38, 0, tzinfo=datetime.timezone.utc)
|
|
62
|
-
|
|
63
|
-
result = await client.property.rfc7231(
|
|
64
|
-
Rfc7231DatetimeProperty(
|
|
65
|
-
value=datetime.datetime(2022, 8, 26, 14, 38, 0, tzinfo=datetime.timezone.utc),
|
|
66
|
-
)
|
|
67
|
-
)
|
|
68
|
-
assert result.value == datetime.datetime(2022, 8, 26, 14, 38, 0, tzinfo=datetime.timezone.utc)
|
|
69
|
-
|
|
70
|
-
result = await client.property.unix_timestamp(
|
|
71
|
-
UnixTimestampDatetimeProperty(
|
|
72
|
-
value=datetime.datetime(2023, 6, 12, 10, 47, 44, tzinfo=datetime.timezone.utc),
|
|
73
|
-
)
|
|
74
|
-
)
|
|
75
|
-
assert result.value == datetime.datetime(2023, 6, 12, 10, 47, 44, tzinfo=datetime.timezone.utc)
|
|
76
|
-
|
|
77
|
-
result = await client.property.unix_timestamp_array(
|
|
78
|
-
UnixTimestampArrayDatetimeProperty(
|
|
79
|
-
value=[
|
|
80
|
-
datetime.datetime(2023, 6, 12, 10, 47, 44, tzinfo=datetime.timezone.utc),
|
|
81
|
-
datetime.datetime(2023, 6, 14, 9, 17, 36, tzinfo=datetime.timezone.utc),
|
|
82
|
-
],
|
|
83
|
-
)
|
|
84
|
-
)
|
|
85
|
-
assert result.value == [
|
|
86
|
-
datetime.datetime(2023, 6, 12, 10, 47, 44, tzinfo=datetime.timezone.utc),
|
|
87
|
-
datetime.datetime(2023, 6, 14, 9, 17, 36, tzinfo=datetime.timezone.utc),
|
|
88
|
-
]
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
@pytest.mark.asyncio
|
|
92
|
-
async def test_header(client: DatetimeClient):
|
|
93
|
-
await client.header.default(
|
|
94
|
-
value=datetime.datetime(2022, 8, 26, 14, 38, 0, tzinfo=datetime.timezone.utc),
|
|
95
|
-
)
|
|
96
|
-
await client.header.rfc3339(
|
|
97
|
-
value=datetime.datetime(2022, 8, 26, 18, 38, 0, tzinfo=datetime.timezone.utc),
|
|
98
|
-
)
|
|
99
|
-
await client.header.rfc7231(
|
|
100
|
-
value=datetime.datetime(2022, 8, 26, 14, 38, 0, tzinfo=datetime.timezone.utc),
|
|
101
|
-
)
|
|
102
|
-
await client.header.unix_timestamp(
|
|
103
|
-
value=datetime.datetime(2023, 6, 12, 10, 47, 44, tzinfo=datetime.timezone.utc),
|
|
104
|
-
)
|
|
105
|
-
await client.header.unix_timestamp_array(
|
|
106
|
-
value=[
|
|
107
|
-
datetime.datetime(2023, 6, 12, 10, 47, 44, tzinfo=datetime.timezone.utc),
|
|
108
|
-
datetime.datetime(2023, 6, 14, 9, 17, 36, tzinfo=datetime.timezone.utc),
|
|
109
|
-
]
|
|
110
|
-
)
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
@pytest.mark.asyncio
|
|
114
|
-
async def test_response_header(client: DatetimeClient):
|
|
115
|
-
cls = lambda x, y, z: z
|
|
116
|
-
assert (await client.response_header.default(cls=cls))["value"] == datetime.datetime(
|
|
117
|
-
2022, 8, 26, 14, 38, 0, tzinfo=datetime.timezone.utc
|
|
118
|
-
)
|
|
119
|
-
assert (await client.response_header.rfc3339(cls=cls))["value"] == datetime.datetime(
|
|
120
|
-
2022, 8, 26, 18, 38, 0, tzinfo=datetime.timezone.utc
|
|
121
|
-
)
|
|
122
|
-
assert (await client.response_header.rfc7231(cls=cls))["value"] == datetime.datetime(
|
|
123
|
-
2022, 8, 26, 14, 38, 0, tzinfo=datetime.timezone.utc
|
|
124
|
-
)
|
|
125
|
-
assert (await client.response_header.unix_timestamp(cls=cls))["value"] == datetime.datetime(
|
|
126
|
-
2023, 6, 12, 10, 47, 44, tzinfo=datetime.timezone.utc
|
|
127
|
-
)
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# -------------------------------------------------------------------------
|
|
2
|
-
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
# Licensed under the MIT License. See License.txt in the project root for
|
|
4
|
-
# license information.
|
|
5
|
-
# --------------------------------------------------------------------------
|
|
6
|
-
import pytest
|
|
7
|
-
from headasbooleantrue.aio import VisibilityClient as HeadAsBooleanTrueClient
|
|
8
|
-
from headasbooleantrue import models as models_true
|
|
9
|
-
|
|
10
|
-
from headasbooleanfalse.aio import VisibilityClient as HeadAsBooleanFalseClient
|
|
11
|
-
from headasbooleanfalse import models as models_false
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
@pytest.fixture
|
|
15
|
-
async def client_true():
|
|
16
|
-
async with HeadAsBooleanTrueClient() as client:
|
|
17
|
-
yield client
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
@pytest.fixture
|
|
21
|
-
async def client_false():
|
|
22
|
-
async with HeadAsBooleanFalseClient() as client:
|
|
23
|
-
yield client
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
@pytest.mark.asyncio
|
|
27
|
-
async def test_head_true(client_true):
|
|
28
|
-
body = models_true.VisibilityModel()
|
|
29
|
-
assert await client_true.head_model(body, query_prop=123) == True
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
@pytest.mark.asyncio
|
|
33
|
-
async def test_head_false(client_false):
|
|
34
|
-
body = models_false.VisibilityModel()
|
|
35
|
-
assert await client_false.head_model(body, query_prop=123) is None
|
package/generator/test/generic_mock_api_tests/asynctests/test_parameters_body_optionality_async.py
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# -------------------------------------------------------------------------
|
|
2
|
-
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
# Licensed under the MIT License. See License.txt in the project root for
|
|
4
|
-
# license information.
|
|
5
|
-
# --------------------------------------------------------------------------
|
|
6
|
-
import pytest
|
|
7
|
-
from parameters.bodyoptionality.aio import BodyOptionalityClient
|
|
8
|
-
from parameters.bodyoptionality.models import BodyModel
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
@pytest.fixture
|
|
12
|
-
async def client():
|
|
13
|
-
async with BodyOptionalityClient() as client:
|
|
14
|
-
yield client
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
@pytest.mark.asyncio
|
|
18
|
-
async def test_required_explicit(client: BodyOptionalityClient):
|
|
19
|
-
await client.required_explicit(BodyModel(name="foo"))
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
@pytest.mark.asyncio
|
|
23
|
-
async def test_required_implicit(client: BodyOptionalityClient):
|
|
24
|
-
await client.required_implicit(name="foo")
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
@pytest.mark.asyncio
|
|
28
|
-
async def test_optional_explicit(client: BodyOptionalityClient):
|
|
29
|
-
await client.optional_explicit.set(BodyModel(name="foo"))
|
|
30
|
-
await client.optional_explicit.omit()
|