@typespec/http-client-python 0.28.2 → 0.29.0
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 +7 -6
- package/dist/emitter/code-model.js.map +1 -1
- package/dist/emitter/constants.d.ts +6 -0
- package/dist/emitter/constants.d.ts.map +1 -0
- package/dist/emitter/constants.js +27 -0
- package/dist/emitter/constants.js.map +1 -0
- package/dist/emitter/emitter.d.ts.map +1 -1
- package/dist/emitter/emitter.js +193 -119
- package/dist/emitter/emitter.js.map +1 -1
- package/dist/emitter/http.d.ts.map +1 -1
- package/dist/emitter/http.js +33 -1
- package/dist/emitter/http.js.map +1 -1
- package/dist/emitter/lib.d.ts +37 -3
- package/dist/emitter/lib.d.ts.map +1 -1
- package/dist/emitter/lib.js +17 -0
- package/dist/emitter/lib.js.map +1 -1
- package/dist/emitter/run-python3.js +1 -1
- package/dist/emitter/run-python3.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 +86 -63
- 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 +7 -13
- package/emitter/src/constants.ts +27 -0
- package/emitter/src/emitter.ts +241 -123
- package/emitter/src/http.ts +29 -1
- package/emitter/src/lib.ts +24 -0
- package/emitter/src/run-python3.ts +1 -1
- package/emitter/src/system-requirements.ts +4 -4
- package/emitter/src/types.ts +102 -62
- package/emitter/src/utils.ts +16 -18
- package/emitter/temp/tsconfig.tsbuildinfo +1 -1
- package/emitter/test/utils.test.ts +3 -0
- package/emitter/tsconfig.build.json +2 -1
- package/emitter/tsconfig.json +2 -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 +64 -0
- package/eng/scripts/ci/{mypy.ini → config/mypy.ini} +1 -1
- package/eng/scripts/ci/{pylintrc → config/pylintrc} +1 -1
- package/eng/scripts/ci/{pyrightconfig.json → config/pyrightconfig.json} +1 -1
- package/eng/scripts/ci/dev_requirements.txt +2 -1
- package/eng/scripts/ci/format.ts +232 -2
- package/eng/scripts/ci/lint.ts +223 -20
- package/eng/scripts/ci/regenerate-common.ts +411 -136
- package/eng/scripts/ci/regenerate.ts +247 -101
- package/eng/scripts/ci/run-tests.ts +507 -0
- package/eng/scripts/ci/run_apiview.py +22 -16
- package/eng/scripts/ci/run_mypy.py +34 -23
- package/eng/scripts/ci/run_pylint.py +27 -19
- package/eng/scripts/ci/run_pyright.py +9 -5
- package/eng/scripts/ci/run_sphinx_build.py +24 -9
- package/eng/scripts/ci/typecheck.ts +225 -0
- package/eng/scripts/ci/util.py +61 -25
- 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 +4 -3
- package/eng/scripts/setup/install.py +4 -3
- package/eng/scripts/setup/install.ts +1 -1
- package/eng/scripts/setup/prepare.py +3 -2
- package/eng/scripts/setup/prepare.ts +1 -1
- package/eng/scripts/setup/run-python3.ts +1 -1
- package/eng/scripts/setup/run_batch.py +197 -0
- 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 -1
- package/generator/build/lib/pygen/__init__.py +1 -3
- package/generator/build/lib/pygen/codegen/__init__.py +0 -1
- package/generator/build/lib/pygen/codegen/models/base.py +0 -1
- package/generator/build/lib/pygen/codegen/models/client.py +2 -1
- package/generator/build/lib/pygen/codegen/models/code_model.py +1 -0
- package/generator/build/lib/pygen/codegen/models/enum_type.py +0 -1
- package/generator/build/lib/pygen/codegen/models/model_type.py +1 -7
- package/generator/build/lib/pygen/codegen/models/parameter.py +16 -14
- package/generator/build/lib/pygen/codegen/serializers/__init__.py +27 -12
- package/generator/build/lib/pygen/codegen/serializers/builder_serializer.py +12 -3
- package/generator/build/lib/pygen/codegen/serializers/general_serializer.py +6 -2
- package/generator/build/lib/pygen/codegen/serializers/import_serializer.py +17 -4
- package/generator/build/lib/pygen/codegen/serializers/parameter_serializer.py +17 -11
- package/generator/build/lib/pygen/codegen/templates/model_base.py.jinja2 +176 -71
- package/generator/build/lib/pygen/codegen/templates/packaging_templates/README.md.jinja2 +11 -3
- package/generator/build/lib/pygen/codegen/templates/packaging_templates/pyproject.toml.jinja2 +1 -1
- package/generator/build/lib/pygen/codegen/templates/serialization.py.jinja2 +5 -1
- package/generator/build/lib/pygen/preprocess/__init__.py +37 -30
- package/generator/component-detection-pip-report.json +7 -7
- package/generator/dist/pygen-0.1.0-py3-none-any.whl +0 -0
- package/generator/pygen/__init__.py +1 -3
- package/generator/pygen/codegen/__init__.py +0 -1
- package/generator/pygen/codegen/models/base.py +0 -1
- package/generator/pygen/codegen/models/client.py +2 -1
- package/generator/pygen/codegen/models/code_model.py +1 -0
- package/generator/pygen/codegen/models/enum_type.py +0 -1
- package/generator/pygen/codegen/models/model_type.py +1 -7
- package/generator/pygen/codegen/models/parameter.py +16 -14
- package/generator/pygen/codegen/serializers/__init__.py +27 -12
- package/generator/pygen/codegen/serializers/builder_serializer.py +12 -3
- package/generator/pygen/codegen/serializers/general_serializer.py +6 -2
- package/generator/pygen/codegen/serializers/import_serializer.py +17 -4
- package/generator/pygen/codegen/serializers/parameter_serializer.py +17 -11
- package/generator/pygen/codegen/templates/model_base.py.jinja2 +176 -71
- package/generator/pygen/codegen/templates/packaging_templates/README.md.jinja2 +11 -3
- package/generator/pygen/codegen/templates/packaging_templates/pyproject.toml.jinja2 +1 -1
- package/generator/pygen/codegen/templates/serialization.py.jinja2 +5 -1
- package/generator/pygen/preprocess/__init__.py +37 -30
- package/generator/pygen.egg-info/PKG-INFO +1 -2
- package/generator/pygen.egg-info/requires.txt +1 -1
- package/generator/setup.py +1 -2
- package/package.json +63 -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/{pyproject.toml → config/pyproject.toml} +0 -0
|
@@ -1,76 +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.spread.aio import SpreadClient
|
|
8
|
-
from parameters.spread.models import BodyParameter
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
@pytest.fixture
|
|
12
|
-
async def client():
|
|
13
|
-
async with SpreadClient() as client:
|
|
14
|
-
yield client
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
@pytest.mark.asyncio
|
|
18
|
-
async def test_model_body(client: SpreadClient):
|
|
19
|
-
await client.model.spread_as_request_body(name="foo")
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
@pytest.mark.asyncio
|
|
23
|
-
async def test_model_composite_request_only_with_body(client: SpreadClient):
|
|
24
|
-
await client.model.spread_composite_request_only_with_body(BodyParameter(name="foo"))
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
@pytest.mark.asyncio
|
|
28
|
-
async def test_model_composite_request_without_body(client: SpreadClient):
|
|
29
|
-
await client.model.spread_composite_request_without_body(name="foo", test_header="bar")
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
@pytest.mark.asyncio
|
|
33
|
-
async def test_model_composite_request(client: SpreadClient):
|
|
34
|
-
await client.model.spread_composite_request(name="foo", body=BodyParameter(name="foo"), test_header="bar")
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
@pytest.mark.asyncio
|
|
38
|
-
async def test_model_composite_request_mix(client: SpreadClient):
|
|
39
|
-
await client.model.spread_composite_request_mix(name="foo", prop="foo", test_header="bar")
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
@pytest.mark.asyncio
|
|
43
|
-
async def test_alias_body(client: SpreadClient):
|
|
44
|
-
await client.alias.spread_as_request_body(name="foo")
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
@pytest.mark.asyncio
|
|
48
|
-
async def test_alias_parameter(client: SpreadClient):
|
|
49
|
-
await client.alias.spread_as_request_parameter("1", x_ms_test_header="bar", name="foo")
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
@pytest.mark.asyncio
|
|
53
|
-
async def test_alias_multiple_parameter(client: SpreadClient):
|
|
54
|
-
await client.alias.spread_with_multiple_parameters(
|
|
55
|
-
"1",
|
|
56
|
-
x_ms_test_header="bar",
|
|
57
|
-
required_string="foo",
|
|
58
|
-
required_int_list=[1, 2],
|
|
59
|
-
optional_string_list=["foo", "bar"],
|
|
60
|
-
optional_int=1,
|
|
61
|
-
)
|
|
62
|
-
await client.alias.spread_with_multiple_parameters(
|
|
63
|
-
"1",
|
|
64
|
-
{"requiredString": "foo", "optionalInt": 1, "requiredIntList": [1, 2], "optionalStringList": ["foo", "bar"]},
|
|
65
|
-
x_ms_test_header="bar",
|
|
66
|
-
)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
@pytest.mark.asyncio
|
|
70
|
-
async def test_inner_model(client: SpreadClient):
|
|
71
|
-
await client.alias.spread_parameter_with_inner_model(id="1", x_ms_test_header="bar", body={"name": "foo"})
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
@pytest.mark.asyncio
|
|
75
|
-
async def test_inner_alias(client: SpreadClient):
|
|
76
|
-
await client.alias.spread_parameter_with_inner_alias(id="1", x_ms_test_header="bar", body={"name": "foo", "age": 1})
|
package/generator/test/azure/mock_api_tests/asynctests/test_payload_content_negotiation_async.py
DELETED
|
@@ -1,37 +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 base64
|
|
7
|
-
import pytest
|
|
8
|
-
from payload.contentnegotiation.aio import ContentNegotiationClient
|
|
9
|
-
from payload.contentnegotiation.models import PngImageAsJson
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
@pytest.fixture
|
|
13
|
-
async def client():
|
|
14
|
-
async with ContentNegotiationClient(endpoint="http://localhost:3000") as client:
|
|
15
|
-
yield client
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
@pytest.mark.asyncio
|
|
19
|
-
async def test_get_avatar_as_png(client: ContentNegotiationClient, png_data: bytes):
|
|
20
|
-
assert b"".join([d async for d in (await client.same_body.get_avatar_as_png())]) == png_data
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
@pytest.mark.asyncio
|
|
24
|
-
async def test_get_avatar_as_jpeg(client: ContentNegotiationClient, jpg_data: bytes):
|
|
25
|
-
assert b"".join([d async for d in (await client.same_body.get_avatar_as_jpeg())]) == jpg_data
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
@pytest.mark.asyncio
|
|
29
|
-
async def test_different_body_get_avatar_as_png(client: ContentNegotiationClient, png_data: bytes):
|
|
30
|
-
assert b"".join([d async for d in (await client.different_body.get_avatar_as_png())]) == png_data
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
@pytest.mark.asyncio
|
|
34
|
-
async def test_different_body_get_avatar_as_json(client: ContentNegotiationClient, png_data: bytes):
|
|
35
|
-
result = await client.different_body.get_avatar_as_json()
|
|
36
|
-
expected = PngImageAsJson(content=base64.b64encode(png_data).decode())
|
|
37
|
-
assert result == expected
|
|
@@ -1,216 +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
|
-
from pathlib import Path
|
|
7
|
-
import pytest
|
|
8
|
-
from payload.multipart import models
|
|
9
|
-
from payload.multipart.aio import MultiPartClient
|
|
10
|
-
|
|
11
|
-
JPG = Path(__file__).parent.parent / "data/image.jpg"
|
|
12
|
-
PNG = Path(__file__).parent.parent / "data/image.png"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
@pytest.fixture
|
|
16
|
-
async def client():
|
|
17
|
-
async with MultiPartClient(endpoint="http://localhost:3000") as client:
|
|
18
|
-
yield client
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
@pytest.mark.asyncio
|
|
22
|
-
async def test_anonymous_model(client: MultiPartClient):
|
|
23
|
-
await client.form_data.anonymous_model({"profileImage": open(str(JPG), "rb")})
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
@pytest.mark.asyncio
|
|
27
|
-
async def test_basic(client: MultiPartClient):
|
|
28
|
-
await client.form_data.basic(
|
|
29
|
-
models.MultiPartRequest(
|
|
30
|
-
id="123",
|
|
31
|
-
profile_image=open(str(JPG), "rb"),
|
|
32
|
-
)
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
@pytest.mark.asyncio
|
|
37
|
-
async def test_binary_array_parts(client: MultiPartClient):
|
|
38
|
-
await client.form_data.binary_array_parts(
|
|
39
|
-
models.BinaryArrayPartsRequest(
|
|
40
|
-
id="123",
|
|
41
|
-
pictures=[
|
|
42
|
-
open(str(PNG), "rb"),
|
|
43
|
-
open(str(PNG), "rb"),
|
|
44
|
-
],
|
|
45
|
-
)
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
@pytest.mark.asyncio
|
|
50
|
-
async def test_check_file_name_and_content_type(client: MultiPartClient):
|
|
51
|
-
await client.form_data.check_file_name_and_content_type(
|
|
52
|
-
models.MultiPartRequest(
|
|
53
|
-
id="123",
|
|
54
|
-
profile_image=("hello.jpg", open(str(JPG), "rb"), "image/jpg"),
|
|
55
|
-
)
|
|
56
|
-
)
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
@pytest.mark.asyncio
|
|
60
|
-
async def test_complex(client: MultiPartClient):
|
|
61
|
-
await client.form_data.file_array_and_basic(
|
|
62
|
-
models.ComplexPartsRequest(
|
|
63
|
-
id="123",
|
|
64
|
-
address=models.Address(city="X"),
|
|
65
|
-
pictures=[
|
|
66
|
-
open(str(PNG), "rb"),
|
|
67
|
-
open(str(PNG), "rb"),
|
|
68
|
-
],
|
|
69
|
-
profile_image=open(str(JPG), "rb"),
|
|
70
|
-
)
|
|
71
|
-
)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
@pytest.mark.asyncio
|
|
75
|
-
async def test_json_part(client: MultiPartClient):
|
|
76
|
-
await client.form_data.json_part(
|
|
77
|
-
models.JsonPartRequest(
|
|
78
|
-
address=models.Address(city="X"),
|
|
79
|
-
profile_image=open(str(JPG), "rb"),
|
|
80
|
-
)
|
|
81
|
-
)
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
@pytest.mark.asyncio
|
|
85
|
-
async def test_multi_binary_parts(client: MultiPartClient):
|
|
86
|
-
await client.form_data.multi_binary_parts(
|
|
87
|
-
models.MultiBinaryPartsRequest(
|
|
88
|
-
profile_image=open(str(JPG), "rb"),
|
|
89
|
-
picture=open(str(PNG), "rb"),
|
|
90
|
-
)
|
|
91
|
-
)
|
|
92
|
-
await client.form_data.multi_binary_parts(
|
|
93
|
-
models.MultiBinaryPartsRequest(
|
|
94
|
-
profile_image=open(str(JPG), "rb"),
|
|
95
|
-
)
|
|
96
|
-
)
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
@pytest.mark.asyncio
|
|
100
|
-
async def test_file_with_http_part_specific_content_type(client: MultiPartClient):
|
|
101
|
-
await client.form_data.http_parts.content_type.image_jpeg_content_type(
|
|
102
|
-
models.FileWithHttpPartSpecificContentTypeRequest(
|
|
103
|
-
profile_image=("hello.jpg", open(str(JPG), "rb"), "image/jpg"),
|
|
104
|
-
)
|
|
105
|
-
)
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
@pytest.mark.asyncio
|
|
109
|
-
async def test_file_with_http_part_required_content_type(client: MultiPartClient):
|
|
110
|
-
await client.form_data.http_parts.content_type.required_content_type(
|
|
111
|
-
models.FileWithHttpPartRequiredContentTypeRequest(
|
|
112
|
-
profile_image=open(str(JPG), "rb"),
|
|
113
|
-
)
|
|
114
|
-
)
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
@pytest.mark.asyncio
|
|
118
|
-
async def test_file_with_http_part_optional_content_type(client: MultiPartClient):
|
|
119
|
-
# call twice: one with content type, one without
|
|
120
|
-
await client.form_data.http_parts.content_type.optional_content_type(
|
|
121
|
-
models.FileWithHttpPartOptionalContentTypeRequest(
|
|
122
|
-
profile_image=("hello.jpg", open(str(JPG), "rb").read()),
|
|
123
|
-
)
|
|
124
|
-
)
|
|
125
|
-
await client.form_data.http_parts.content_type.optional_content_type(
|
|
126
|
-
models.FileWithHttpPartOptionalContentTypeRequest(
|
|
127
|
-
profile_image=("hello.jpg", open(str(JPG), "rb").read(), "application/octet-stream"),
|
|
128
|
-
)
|
|
129
|
-
)
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
@pytest.mark.asyncio
|
|
133
|
-
async def test_complex_with_http_part(client: MultiPartClient):
|
|
134
|
-
await client.form_data.http_parts.json_array_and_file_array(
|
|
135
|
-
models.ComplexHttpPartsModelRequest(
|
|
136
|
-
id="123",
|
|
137
|
-
previous_addresses=[
|
|
138
|
-
models.Address(city="Y"),
|
|
139
|
-
models.Address(city="Z"),
|
|
140
|
-
],
|
|
141
|
-
address=models.Address(city="X"),
|
|
142
|
-
pictures=[
|
|
143
|
-
open(str(PNG), "rb"),
|
|
144
|
-
open(str(PNG), "rb"),
|
|
145
|
-
],
|
|
146
|
-
profile_image=open(str(JPG), "rb"),
|
|
147
|
-
)
|
|
148
|
-
)
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
@pytest.mark.asyncio
|
|
152
|
-
async def test_http_parts_non_string_float(client: MultiPartClient):
|
|
153
|
-
await client.form_data.http_parts.non_string.float(models.FloatRequest(temperature=0.5))
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
@pytest.mark.asyncio
|
|
157
|
-
async def test_with_wire_name(client: MultiPartClient):
|
|
158
|
-
await client.form_data.with_wire_name(
|
|
159
|
-
models.MultiPartRequestWithWireName(
|
|
160
|
-
identifier="123",
|
|
161
|
-
image=open(str(JPG), "rb"),
|
|
162
|
-
)
|
|
163
|
-
)
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
@pytest.mark.asyncio
|
|
167
|
-
async def test_optional_parts(client: MultiPartClient):
|
|
168
|
-
# First time with only id
|
|
169
|
-
await client.form_data.optional_parts(
|
|
170
|
-
models.MultiPartOptionalRequest(
|
|
171
|
-
id="123",
|
|
172
|
-
)
|
|
173
|
-
)
|
|
174
|
-
# Second time with only profileImage
|
|
175
|
-
await client.form_data.optional_parts(
|
|
176
|
-
models.MultiPartOptionalRequest(
|
|
177
|
-
profile_image=open(str(JPG), "rb"),
|
|
178
|
-
)
|
|
179
|
-
)
|
|
180
|
-
# Third time with both id and profileImage
|
|
181
|
-
await client.form_data.optional_parts(
|
|
182
|
-
models.MultiPartOptionalRequest(
|
|
183
|
-
id="123",
|
|
184
|
-
profile_image=open(str(JPG), "rb"),
|
|
185
|
-
)
|
|
186
|
-
)
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
@pytest.mark.asyncio
|
|
190
|
-
async def test_file_upload_file_specific_content_type(client: MultiPartClient):
|
|
191
|
-
await client.form_data.file.upload_file_specific_content_type(
|
|
192
|
-
models.UploadFileSpecificContentTypeRequest(
|
|
193
|
-
file=("image.png", open(str(PNG), "rb"), "image/png"),
|
|
194
|
-
)
|
|
195
|
-
)
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
@pytest.mark.asyncio
|
|
199
|
-
async def test_file_upload_file_required_filename(client: MultiPartClient):
|
|
200
|
-
await client.form_data.file.upload_file_required_filename(
|
|
201
|
-
models.UploadFileRequiredFilenameRequest(
|
|
202
|
-
file=("image.png", open(str(PNG), "rb"), "image/png"),
|
|
203
|
-
)
|
|
204
|
-
)
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
@pytest.mark.asyncio
|
|
208
|
-
async def test_file_upload_file_array(client: MultiPartClient):
|
|
209
|
-
await client.form_data.file.upload_file_array(
|
|
210
|
-
models.UploadFileArrayRequest(
|
|
211
|
-
files=[
|
|
212
|
-
("image.png", open(str(PNG), "rb"), "image/png"),
|
|
213
|
-
("image.png", open(str(PNG), "rb"), "image/png"),
|
|
214
|
-
],
|
|
215
|
-
)
|
|
216
|
-
)
|
|
@@ -1,130 +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 resiliency.srv.driven1.aio import ResiliencyServiceDrivenClient as V1Client
|
|
8
|
-
from resiliency.srv.driven2.aio import ResiliencyServiceDrivenClient as V2Client
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def get_v1_client(service_deployment_version: str, api_version: str = "v1") -> V1Client:
|
|
12
|
-
return V1Client(
|
|
13
|
-
endpoint="http://localhost:3000",
|
|
14
|
-
service_deployment_version=service_deployment_version,
|
|
15
|
-
api_version=api_version,
|
|
16
|
-
)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
def get_v2_client(service_deployment_version: str, api_version: str = "v2") -> V2Client:
|
|
20
|
-
return V2Client(
|
|
21
|
-
endpoint="http://localhost:3000",
|
|
22
|
-
service_deployment_version=service_deployment_version,
|
|
23
|
-
api_version=api_version,
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
@pytest.mark.asyncio
|
|
28
|
-
async def test_add_optional_param_from_none():
|
|
29
|
-
# old client to old service with api version v1
|
|
30
|
-
async with V1Client(endpoint="http://localhost:3000", service_deployment_version="v1") as client:
|
|
31
|
-
await client.from_none()
|
|
32
|
-
|
|
33
|
-
# old client to new service with api version v1
|
|
34
|
-
async with V1Client(endpoint="http://localhost:3000", service_deployment_version="v2") as client:
|
|
35
|
-
await client.from_none()
|
|
36
|
-
|
|
37
|
-
# new client to new service with api version v1
|
|
38
|
-
async with V2Client(
|
|
39
|
-
endpoint="http://localhost:3000",
|
|
40
|
-
service_deployment_version="v2",
|
|
41
|
-
api_version="v1",
|
|
42
|
-
) as client:
|
|
43
|
-
await client.from_none()
|
|
44
|
-
|
|
45
|
-
# new client to new service with api version v2
|
|
46
|
-
async with V2Client(endpoint="http://localhost:3000", service_deployment_version="v2") as client:
|
|
47
|
-
await client.from_none(new_parameter="new")
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
@pytest.mark.asyncio
|
|
51
|
-
async def test_add_optional_param_from_one_required():
|
|
52
|
-
# old client to old service with api version v1
|
|
53
|
-
async with V1Client(endpoint="http://localhost:3000", service_deployment_version="v1") as client:
|
|
54
|
-
await client.from_one_required(parameter="required")
|
|
55
|
-
|
|
56
|
-
# old client to new service with api version v1
|
|
57
|
-
async with V1Client(endpoint="http://localhost:3000", service_deployment_version="v2") as client:
|
|
58
|
-
await client.from_one_required(parameter="required")
|
|
59
|
-
|
|
60
|
-
# new client to new service with api version v1
|
|
61
|
-
async with V2Client(
|
|
62
|
-
endpoint="http://localhost:3000",
|
|
63
|
-
service_deployment_version="v2",
|
|
64
|
-
api_version="v1",
|
|
65
|
-
) as client:
|
|
66
|
-
await client.from_one_required(parameter="required")
|
|
67
|
-
|
|
68
|
-
# new client to new service with api version v2
|
|
69
|
-
async with V2Client(endpoint="http://localhost:3000", service_deployment_version="v2") as client:
|
|
70
|
-
await client.from_one_required(parameter="required", new_parameter="new")
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
@pytest.mark.asyncio
|
|
74
|
-
async def test_add_optional_param_from_one_optional():
|
|
75
|
-
# old client to old service with api version v1
|
|
76
|
-
async with V1Client(endpoint="http://localhost:3000", service_deployment_version="v1") as client:
|
|
77
|
-
await client.from_one_optional(parameter="optional")
|
|
78
|
-
|
|
79
|
-
# old client to new service with api version v1
|
|
80
|
-
async with V1Client(endpoint="http://localhost:3000", service_deployment_version="v2") as client:
|
|
81
|
-
await client.from_one_optional(parameter="optional")
|
|
82
|
-
|
|
83
|
-
# new client to new service with api version v1
|
|
84
|
-
async with V2Client(
|
|
85
|
-
endpoint="http://localhost:3000",
|
|
86
|
-
service_deployment_version="v2",
|
|
87
|
-
api_version="v1",
|
|
88
|
-
) as client:
|
|
89
|
-
await client.from_one_optional(parameter="optional")
|
|
90
|
-
|
|
91
|
-
# new client to new service with api version v2
|
|
92
|
-
async with V2Client(endpoint="http://localhost:3000", service_deployment_version="v2") as client:
|
|
93
|
-
await client.from_one_optional(parameter="optional", new_parameter="new")
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
@pytest.mark.asyncio
|
|
97
|
-
async def test_break_the_glass():
|
|
98
|
-
from azure.core.rest import HttpRequest
|
|
99
|
-
|
|
100
|
-
request = HttpRequest(method="DELETE", url="/add-operation")
|
|
101
|
-
async with V1Client(
|
|
102
|
-
endpoint="http://localhost:3000",
|
|
103
|
-
service_deployment_version="v2",
|
|
104
|
-
api_version="v2",
|
|
105
|
-
) as client:
|
|
106
|
-
response = await client.send_request(request)
|
|
107
|
-
response.raise_for_status()
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
@pytest.mark.asyncio
|
|
111
|
-
async def test_add_operation():
|
|
112
|
-
async with V2Client(endpoint="http://localhost:3000", service_deployment_version="v2") as client:
|
|
113
|
-
await client.add_operation()
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
@pytest.mark.parametrize(
|
|
117
|
-
"func_name, params",
|
|
118
|
-
[
|
|
119
|
-
("from_none", {"new_parameter": "new"}),
|
|
120
|
-
("from_one_optional", {"parameter": "optional", "new_parameter": "new"}),
|
|
121
|
-
("from_one_required", {"parameter": "required", "new_parameter": "new"}),
|
|
122
|
-
("add_operation", {}),
|
|
123
|
-
],
|
|
124
|
-
)
|
|
125
|
-
@pytest.mark.asyncio
|
|
126
|
-
async def test_new_client_with_old_apiversion_call_new_parameter(func_name, params):
|
|
127
|
-
client = get_v2_client(service_deployment_version="v2", api_version="v1")
|
|
128
|
-
with pytest.raises(ValueError) as ex:
|
|
129
|
-
await getattr(client, func_name)(**params)
|
|
130
|
-
assert "is not available in API version" in str(ex.value)
|
package/generator/test/azure/mock_api_tests/asynctests/test_serialization_encoded_name_json_async.py
DELETED
|
@@ -1,24 +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 serialization.encodedname.json.aio import JsonClient
|
|
8
|
-
from serialization.encodedname.json import models
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
@pytest.fixture
|
|
12
|
-
async def client():
|
|
13
|
-
async with JsonClient() as client:
|
|
14
|
-
yield client
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
@pytest.mark.asyncio
|
|
18
|
-
async def test_property_send(client: JsonClient):
|
|
19
|
-
await client.property.send(models.JsonEncodedNameModel(default_name=True))
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
@pytest.mark.asyncio
|
|
23
|
-
async def test_property_get(client: JsonClient):
|
|
24
|
-
assert (await client.property.get()).default_name
|
|
@@ -1,31 +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 azure.core.exceptions import HttpResponseError
|
|
8
|
-
from service.multiservice.aio import CombinedClient
|
|
9
|
-
from service.multiservice.models import VersionsA, VersionsB
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
@pytest.fixture
|
|
13
|
-
def client():
|
|
14
|
-
"""Fixture that creates a CombinedClient for testing."""
|
|
15
|
-
return CombinedClient(endpoint="http://localhost:3000")
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
@pytest.mark.asyncio
|
|
19
|
-
async def test_service_multi_service_foo(client):
|
|
20
|
-
with pytest.raises(HttpResponseError):
|
|
21
|
-
await client.foo.test(api_version=VersionsA.AV1)
|
|
22
|
-
|
|
23
|
-
await client.foo.test()
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
@pytest.mark.asyncio
|
|
27
|
-
async def test_service_multi_service_bar(client):
|
|
28
|
-
with pytest.raises(HttpResponseError):
|
|
29
|
-
await client.bar.test(api_version=VersionsB.BV1)
|
|
30
|
-
|
|
31
|
-
await client.bar.test()
|
|
@@ -1,71 +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 specialwords.aio import SpecialWordsClient
|
|
8
|
-
from specialwords import models
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
@pytest.fixture
|
|
12
|
-
async def client():
|
|
13
|
-
async with SpecialWordsClient() as client:
|
|
14
|
-
yield client
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
@pytest.mark.asyncio
|
|
18
|
-
async def test_operations(client: SpecialWordsClient, special_words):
|
|
19
|
-
for sw in special_words:
|
|
20
|
-
suffix = "" if sw == "constructor" else "_method"
|
|
21
|
-
await getattr(client.operations, sw + suffix)()
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
@pytest.mark.asyncio
|
|
25
|
-
async def test_parameter(client: SpecialWordsClient, special_words):
|
|
26
|
-
for sw in special_words:
|
|
27
|
-
suffix = "" if sw == "constructor" else "_parameter"
|
|
28
|
-
await getattr(client.parameters, "with_" + sw)(**{sw + suffix: "ok"})
|
|
29
|
-
await client.parameters.with_cancellation_token(cancellation_token="ok")
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
@pytest.mark.asyncio
|
|
33
|
-
async def test_model(client: SpecialWordsClient, special_words):
|
|
34
|
-
for sw in special_words:
|
|
35
|
-
suffix = "" if sw == "constructor" else "Model"
|
|
36
|
-
model = getattr(models, sw.capitalize() + suffix)
|
|
37
|
-
await getattr(client.models, "with_" + sw)(model(name="ok"))
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
@pytest.mark.asyncio
|
|
41
|
-
async def test_model_properties(client: SpecialWordsClient):
|
|
42
|
-
await client.model_properties.same_as_model(models.SameAsModel(same_as_model="ok"))
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
@pytest.mark.asyncio
|
|
46
|
-
async def test_model_properties_dict_methods(client: SpecialWordsClient):
|
|
47
|
-
await client.model_properties.dict_methods(
|
|
48
|
-
body=models.DictMethods(
|
|
49
|
-
keys_property="ok",
|
|
50
|
-
items_property="ok",
|
|
51
|
-
values_property="ok",
|
|
52
|
-
popitem_property="ok",
|
|
53
|
-
clear_property="ok",
|
|
54
|
-
update_property="ok",
|
|
55
|
-
setdefault_property="ok",
|
|
56
|
-
pop_property="ok",
|
|
57
|
-
get_property="ok",
|
|
58
|
-
copy_property="ok",
|
|
59
|
-
)
|
|
60
|
-
)
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
@pytest.mark.asyncio
|
|
64
|
-
async def test_model_properties_with_list(client: SpecialWordsClient):
|
|
65
|
-
await client.model_properties.with_list(models.ModelWithList(list="ok"))
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
@pytest.mark.asyncio
|
|
69
|
-
async def test_extensible_strings(client: SpecialWordsClient):
|
|
70
|
-
for enum_value in models.ExtensibleString:
|
|
71
|
-
assert enum_value == await client.extensible_strings.put_extensible_string_value(body=enum_value)
|