@typespec/http-client-python 0.1.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/README.md +118 -0
- package/dist/emitter/code-model.d.ts +4 -0
- package/dist/emitter/code-model.d.ts.map +1 -0
- package/dist/emitter/code-model.js +195 -0
- package/dist/emitter/code-model.js.map +1 -0
- package/dist/emitter/emitter.d.ts +6 -0
- package/dist/emitter/emitter.d.ts.map +1 -0
- package/dist/emitter/emitter.js +104 -0
- package/dist/emitter/emitter.js.map +1 -0
- package/dist/emitter/external-process.d.ts +20 -0
- package/dist/emitter/external-process.d.ts.map +1 -0
- package/dist/emitter/external-process.js +44 -0
- package/dist/emitter/external-process.js.map +1 -0
- package/dist/emitter/http.d.ts +7 -0
- package/dist/emitter/http.d.ts.map +1 -0
- package/dist/emitter/http.js +268 -0
- package/dist/emitter/http.js.map +1 -0
- package/dist/emitter/index.d.ts +3 -0
- package/dist/emitter/index.d.ts.map +1 -0
- package/dist/emitter/index.js +3 -0
- package/dist/emitter/index.js.map +1 -0
- package/dist/emitter/lib.d.ts +30 -0
- package/dist/emitter/lib.d.ts.map +1 -0
- package/dist/emitter/lib.js +33 -0
- package/dist/emitter/lib.js.map +1 -0
- package/dist/emitter/types.d.ts +36 -0
- package/dist/emitter/types.d.ts.map +1 -0
- package/dist/emitter/types.js +491 -0
- package/dist/emitter/types.js.map +1 -0
- package/dist/emitter/utils.d.ts +26 -0
- package/dist/emitter/utils.d.ts.map +1 -0
- package/dist/emitter/utils.js +155 -0
- package/dist/emitter/utils.js.map +1 -0
- package/emitter/src/code-model.ts +272 -0
- package/emitter/src/emitter.ts +127 -0
- package/emitter/src/external-process.ts +52 -0
- package/emitter/src/http.ts +382 -0
- package/emitter/src/index.ts +2 -0
- package/emitter/src/lib.ts +59 -0
- package/emitter/src/types.ts +573 -0
- package/emitter/src/utils.ts +215 -0
- package/emitter/temp/tsconfig.tsbuildinfo +1 -0
- package/emitter/test/utils.test.ts +22 -0
- package/emitter/tsconfig.build.json +11 -0
- package/emitter/tsconfig.json +7 -0
- package/emitter/vitest.config.ts +4 -0
- package/eng/scripts/Build-Packages.ps1 +86 -0
- package/eng/scripts/Check-GitChanges.ps1 +22 -0
- package/eng/scripts/Functions.ps1 +26 -0
- package/eng/scripts/Generate.ps1 +11 -0
- package/eng/scripts/Generation.psm1 +22 -0
- package/eng/scripts/Initialize-Repository.ps1 +40 -0
- package/eng/scripts/Test-Packages.ps1 +65 -0
- package/eng/scripts/ci/format.ts +3 -0
- package/eng/scripts/ci/lint.ts +39 -0
- package/eng/scripts/ci/mypy.ini +38 -0
- package/eng/scripts/ci/pylintrc +59 -0
- package/eng/scripts/ci/pyproject.toml +18 -0
- package/eng/scripts/ci/pyrightconfig.json +6 -0
- package/eng/scripts/ci/regenerate.ts +299 -0
- package/eng/scripts/ci/run-ci.ts +88 -0
- package/eng/scripts/ci/run_apiview.py +40 -0
- package/eng/scripts/ci/run_mypy.py +49 -0
- package/eng/scripts/ci/run_pylint.py +50 -0
- package/eng/scripts/ci/run_pyright.py +58 -0
- package/eng/scripts/ci/util.py +72 -0
- package/eng/scripts/ci/utils.ts +48 -0
- package/eng/scripts/setup/__pycache__/venvtools.cpython-38.pyc +0 -0
- package/eng/scripts/setup/install.py +53 -0
- package/eng/scripts/setup/prepare.py +42 -0
- package/eng/scripts/setup/run-python3.ts +25 -0
- package/eng/scripts/setup/run_tsp.py +42 -0
- package/eng/scripts/setup/system-requirements.ts +261 -0
- package/eng/scripts/setup/venvtools.py +87 -0
- package/generator/LICENSE +21 -0
- package/generator/README.md +1 -0
- package/generator/dev_requirements.txt +13 -0
- package/generator/pygen/__init__.py +107 -0
- package/generator/pygen/_version.py +7 -0
- package/generator/pygen/black.py +71 -0
- package/generator/pygen/codegen/__init__.py +338 -0
- package/generator/pygen/codegen/_utils.py +17 -0
- package/generator/pygen/codegen/models/__init__.py +204 -0
- package/generator/pygen/codegen/models/base.py +186 -0
- package/generator/pygen/codegen/models/base_builder.py +118 -0
- package/generator/pygen/codegen/models/client.py +433 -0
- package/generator/pygen/codegen/models/code_model.py +237 -0
- package/generator/pygen/codegen/models/combined_type.py +149 -0
- package/generator/pygen/codegen/models/constant_type.py +129 -0
- package/generator/pygen/codegen/models/credential_types.py +214 -0
- package/generator/pygen/codegen/models/dictionary_type.py +127 -0
- package/generator/pygen/codegen/models/enum_type.py +238 -0
- package/generator/pygen/codegen/models/imports.py +291 -0
- package/generator/pygen/codegen/models/list_type.py +143 -0
- package/generator/pygen/codegen/models/lro_operation.py +142 -0
- package/generator/pygen/codegen/models/lro_paging_operation.py +32 -0
- package/generator/pygen/codegen/models/model_type.py +359 -0
- package/generator/pygen/codegen/models/operation.py +530 -0
- package/generator/pygen/codegen/models/operation_group.py +184 -0
- package/generator/pygen/codegen/models/paging_operation.py +155 -0
- package/generator/pygen/codegen/models/parameter.py +412 -0
- package/generator/pygen/codegen/models/parameter_list.py +387 -0
- package/generator/pygen/codegen/models/primitive_types.py +659 -0
- package/generator/pygen/codegen/models/property.py +170 -0
- package/generator/pygen/codegen/models/request_builder.py +189 -0
- package/generator/pygen/codegen/models/request_builder_parameter.py +115 -0
- package/generator/pygen/codegen/models/response.py +348 -0
- package/generator/pygen/codegen/models/utils.py +21 -0
- package/generator/pygen/codegen/serializers/__init__.py +574 -0
- package/generator/pygen/codegen/serializers/base_serializer.py +21 -0
- package/generator/pygen/codegen/serializers/builder_serializer.py +1507 -0
- package/generator/pygen/codegen/serializers/client_serializer.py +294 -0
- package/generator/pygen/codegen/serializers/enum_serializer.py +15 -0
- package/generator/pygen/codegen/serializers/general_serializer.py +213 -0
- package/generator/pygen/codegen/serializers/import_serializer.py +126 -0
- package/generator/pygen/codegen/serializers/metadata_serializer.py +198 -0
- package/generator/pygen/codegen/serializers/model_init_serializer.py +33 -0
- package/generator/pygen/codegen/serializers/model_serializer.py +317 -0
- package/generator/pygen/codegen/serializers/operation_groups_serializer.py +89 -0
- package/generator/pygen/codegen/serializers/operations_init_serializer.py +44 -0
- package/generator/pygen/codegen/serializers/parameter_serializer.py +221 -0
- package/generator/pygen/codegen/serializers/patch_serializer.py +19 -0
- package/generator/pygen/codegen/serializers/request_builders_serializer.py +52 -0
- package/generator/pygen/codegen/serializers/sample_serializer.py +168 -0
- package/generator/pygen/codegen/serializers/test_serializer.py +292 -0
- package/generator/pygen/codegen/serializers/types_serializer.py +31 -0
- package/generator/pygen/codegen/serializers/utils.py +68 -0
- package/generator/pygen/codegen/templates/client.py.jinja2 +37 -0
- package/generator/pygen/codegen/templates/client_container.py.jinja2 +12 -0
- package/generator/pygen/codegen/templates/config.py.jinja2 +73 -0
- package/generator/pygen/codegen/templates/config_container.py.jinja2 +16 -0
- package/generator/pygen/codegen/templates/conftest.py.jinja2 +28 -0
- package/generator/pygen/codegen/templates/enum.py.jinja2 +13 -0
- package/generator/pygen/codegen/templates/enum_container.py.jinja2 +10 -0
- package/generator/pygen/codegen/templates/init.py.jinja2 +24 -0
- package/generator/pygen/codegen/templates/keywords.jinja2 +19 -0
- package/generator/pygen/codegen/templates/lro_operation.py.jinja2 +16 -0
- package/generator/pygen/codegen/templates/lro_paging_operation.py.jinja2 +18 -0
- package/generator/pygen/codegen/templates/macros.jinja2 +12 -0
- package/generator/pygen/codegen/templates/metadata.json.jinja2 +167 -0
- package/generator/pygen/codegen/templates/model_base.py.jinja2 +1157 -0
- package/generator/pygen/codegen/templates/model_container.py.jinja2 +12 -0
- package/generator/pygen/codegen/templates/model_dpg.py.jinja2 +97 -0
- package/generator/pygen/codegen/templates/model_init.py.jinja2 +28 -0
- package/generator/pygen/codegen/templates/model_msrest.py.jinja2 +92 -0
- package/generator/pygen/codegen/templates/operation.py.jinja2 +21 -0
- package/generator/pygen/codegen/templates/operation_group.py.jinja2 +75 -0
- package/generator/pygen/codegen/templates/operation_groups_container.py.jinja2 +19 -0
- package/generator/pygen/codegen/templates/operation_tools.jinja2 +81 -0
- package/generator/pygen/codegen/templates/operations_folder_init.py.jinja2 +17 -0
- package/generator/pygen/codegen/templates/packaging_templates/CHANGELOG.md.jinja2 +6 -0
- package/generator/pygen/codegen/templates/packaging_templates/LICENSE.jinja2 +21 -0
- package/generator/pygen/codegen/templates/packaging_templates/MANIFEST.in.jinja2 +8 -0
- package/generator/pygen/codegen/templates/packaging_templates/README.md.jinja2 +107 -0
- package/generator/pygen/codegen/templates/packaging_templates/dev_requirements.txt.jinja2 +9 -0
- package/generator/pygen/codegen/templates/packaging_templates/setup.py.jinja2 +108 -0
- package/generator/pygen/codegen/templates/paging_operation.py.jinja2 +21 -0
- package/generator/pygen/codegen/templates/patch.py.jinja2 +19 -0
- package/generator/pygen/codegen/templates/pkgutil_init.py.jinja2 +1 -0
- package/generator/pygen/codegen/templates/request_builder.py.jinja2 +28 -0
- package/generator/pygen/codegen/templates/request_builders.py.jinja2 +10 -0
- package/generator/pygen/codegen/templates/rest_init.py.jinja2 +12 -0
- package/generator/pygen/codegen/templates/sample.py.jinja2 +44 -0
- package/generator/pygen/codegen/templates/serialization.py.jinja2 +2114 -0
- package/generator/pygen/codegen/templates/test.py.jinja2 +50 -0
- package/generator/pygen/codegen/templates/testpreparer.py.jinja2 +26 -0
- package/generator/pygen/codegen/templates/types.py.jinja2 +7 -0
- package/generator/pygen/codegen/templates/validation.py.jinja2 +38 -0
- package/generator/pygen/codegen/templates/vendor.py.jinja2 +95 -0
- package/generator/pygen/codegen/templates/version.py.jinja2 +4 -0
- package/generator/pygen/m2r.py +65 -0
- package/generator/pygen/postprocess/__init__.py +183 -0
- package/generator/pygen/postprocess/get_all.py +19 -0
- package/generator/pygen/postprocess/venvtools.py +75 -0
- package/generator/pygen/preprocess/__init__.py +515 -0
- package/generator/pygen/preprocess/helpers.py +27 -0
- package/generator/pygen/preprocess/python_mappings.py +224 -0
- package/generator/pygen/utils.py +163 -0
- package/generator/pygen.egg-info/PKG-INFO +25 -0
- package/generator/pygen.egg-info/SOURCES.txt +66 -0
- package/generator/pygen.egg-info/dependency_links.txt +1 -0
- package/generator/pygen.egg-info/requires.txt +4 -0
- package/generator/pygen.egg-info/top_level.txt +1 -0
- package/generator/requirements.txt +12 -0
- package/generator/setup.py +55 -0
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_models_common_types_managed_identity_async.py +63 -0
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_models_resource_async.py +284 -0
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_access_async.py +101 -0
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_flatten_async.py +93 -0
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_usage_async.py +31 -0
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_basic_async.py +76 -0
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_lro_rpc_async.py +22 -0
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_lro_standard_async.py +39 -0
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_model_async.py +33 -0
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_page_async.py +58 -0
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_scalar_async.py +41 -0
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_traits_async.py +87 -0
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_example_basic_async.py +30 -0
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_special_headers_client_request_id_async.py +30 -0
- package/generator/test/azure/mock_api_tests/conftest.py +150 -0
- package/generator/test/azure/mock_api_tests/test_azure_arm_models_common_types_managed_identity.py +60 -0
- package/generator/test/azure/mock_api_tests/test_azure_arm_models_resource.py +254 -0
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_access.py +92 -0
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_flatten.py +84 -0
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_usage.py +28 -0
- package/generator/test/azure/mock_api_tests/test_azure_core_basic.py +70 -0
- package/generator/test/azure/mock_api_tests/test_azure_core_lro_rpc.py +20 -0
- package/generator/test/azure/mock_api_tests/test_azure_core_lro_standard.py +32 -0
- package/generator/test/azure/mock_api_tests/test_azure_core_model.py +30 -0
- package/generator/test/azure/mock_api_tests/test_azure_core_page.py +51 -0
- package/generator/test/azure/mock_api_tests/test_azure_core_scalar.py +35 -0
- package/generator/test/azure/mock_api_tests/test_azure_core_traits.py +85 -0
- package/generator/test/azure/mock_api_tests/test_azure_example_basic.py +29 -0
- package/generator/test/azure/mock_api_tests/test_azure_special_headers_client_request_id.py +29 -0
- package/generator/test/azure/requirements.txt +89 -0
- package/generator/test/azure/tox.ini +56 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_authentication_async.py +121 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_client_naming_async.py +69 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_client_structure_async.py +62 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_encode_bytes_async.py +133 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_encode_datetime_async.py +127 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_encode_duration_async.py +63 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_encode_numeric_async.py +35 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_headasboolean_async.py +35 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_parameters_basic_async.py +24 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_parameters_body_optionality_async.py +30 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_parameters_collection_format_async.py +44 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_parameters_spread_async.py +76 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_payload_content_negotiation_async.py +37 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_payload_json_merge_patch_async.py +98 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_payload_media_type_async.py +27 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_payload_multipart_async.py +153 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_payload_pageable_async.py +19 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_payload_xml_async.py +103 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_resiliency_srv_driven_async.py +128 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_routes_async.py +331 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_serialization_encoded_name_json_async.py +24 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_server_endpoint_not_defined_async.py +18 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_server_path_multiple_async.py +25 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_server_path_single_async.py +18 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_server_versions_not_versioned_async.py +28 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_server_versions_versioned_async.py +34 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_special_headers_conditional_request_async.py +38 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_special_headers_repeatability_async.py +19 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_special_words_async.py +42 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_array_async.py +118 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_dictionary_async.py +98 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_enum_extensible_async.py +25 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_enum_fixed_async.py +27 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_empty_async.py +32 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_enum_discriminator_async.py +70 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_nested_discriminator_async.py +85 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_not_discriminated_async.py +34 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_recursive_async.py +34 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_single_discriminator_async.py +67 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_usage_async.py +32 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_visibility_async.py +47 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_property_additionalproperties_async.py +352 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_property_nullable_async.py +110 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_property_optional_async.py +197 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_property_valuetypes_async.py +315 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_scalar_async.py +60 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_union_async.py +90 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_versioning_added_async.py +36 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_versioning_made_optional_async.py +21 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_versioning_removed_async.py +21 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_versioning_renamed_from_async.py +29 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_versioning_return_type_changed_from_async.py +18 -0
- package/generator/test/generic_mock_api_tests/asynctests/test_versioning_type_changed_from_async.py +22 -0
- package/generator/test/generic_mock_api_tests/conftest.py +113 -0
- 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 +113 -0
- package/generator/test/generic_mock_api_tests/test_client_naming.py +57 -0
- package/generator/test/generic_mock_api_tests/test_client_structure.py +57 -0
- package/generator/test/generic_mock_api_tests/test_encode_bytes.py +128 -0
- package/generator/test/generic_mock_api_tests/test_encode_datetime.py +123 -0
- package/generator/test/generic_mock_api_tests/test_encode_duration.py +60 -0
- package/generator/test/generic_mock_api_tests/test_encode_numeric.py +31 -0
- package/generator/test/generic_mock_api_tests/test_headasboolean.py +33 -0
- package/generator/test/generic_mock_api_tests/test_parameters_basic.py +22 -0
- package/generator/test/generic_mock_api_tests/test_parameters_body_optionality.py +27 -0
- package/generator/test/generic_mock_api_tests/test_parameters_collection_format.py +37 -0
- package/generator/test/generic_mock_api_tests/test_parameters_spread.py +66 -0
- package/generator/test/generic_mock_api_tests/test_payload_content_negotiation.py +33 -0
- package/generator/test/generic_mock_api_tests/test_payload_json_merge_patch.py +93 -0
- package/generator/test/generic_mock_api_tests/test_payload_media_type.py +25 -0
- package/generator/test/generic_mock_api_tests/test_payload_multipart.py +140 -0
- package/generator/test/generic_mock_api_tests/test_payload_pageable.py +18 -0
- package/generator/test/generic_mock_api_tests/test_payload_xml.py +93 -0
- package/generator/test/generic_mock_api_tests/test_resiliency_srv_driven.py +122 -0
- package/generator/test/generic_mock_api_tests/test_routes.py +285 -0
- package/generator/test/generic_mock_api_tests/test_serialization_encoded_name_json.py +21 -0
- package/generator/test/generic_mock_api_tests/test_server_endpoint_not_defined.py +17 -0
- package/generator/test/generic_mock_api_tests/test_server_path_multiple.py +21 -0
- package/generator/test/generic_mock_api_tests/test_server_path_single.py +17 -0
- package/generator/test/generic_mock_api_tests/test_server_versions_not_versioned.py +25 -0
- package/generator/test/generic_mock_api_tests/test_server_versions_versioned.py +30 -0
- package/generator/test/generic_mock_api_tests/test_special_headers_conditional_request.py +34 -0
- package/generator/test/generic_mock_api_tests/test_special_headers_repeatability.py +18 -0
- package/generator/test/generic_mock_api_tests/test_special_words.py +37 -0
- package/generator/test/generic_mock_api_tests/test_typetest_array.py +103 -0
- package/generator/test/generic_mock_api_tests/test_typetest_dictionary.py +86 -0
- package/generator/test/generic_mock_api_tests/test_typetest_enum_extensible.py +23 -0
- package/generator/test/generic_mock_api_tests/test_typetest_enum_fixed.py +25 -0
- package/generator/test/generic_mock_api_tests/test_typetest_model_empty.py +29 -0
- package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_enum_discriminator.py +58 -0
- package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_nested_discriminator.py +79 -0
- package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_not_discriminated.py +31 -0
- package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_recursive.py +32 -0
- package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_single_discriminator.py +60 -0
- package/generator/test/generic_mock_api_tests/test_typetest_model_usage.py +28 -0
- package/generator/test/generic_mock_api_tests/test_typetest_model_visibility.py +40 -0
- package/generator/test/generic_mock_api_tests/test_typetest_property_additionalproperties.py +313 -0
- package/generator/test/generic_mock_api_tests/test_typetest_property_nullable.py +102 -0
- package/generator/test/generic_mock_api_tests/test_typetest_property_optional.py +174 -0
- package/generator/test/generic_mock_api_tests/test_typetest_property_valuetypes.py +286 -0
- package/generator/test/generic_mock_api_tests/test_typetest_scalar.py +53 -0
- package/generator/test/generic_mock_api_tests/test_typetest_union.py +80 -0
- package/generator/test/generic_mock_api_tests/test_versioning_added.py +33 -0
- package/generator/test/generic_mock_api_tests/test_versioning_made_optional.py +20 -0
- package/generator/test/generic_mock_api_tests/test_versioning_removed.py +20 -0
- package/generator/test/generic_mock_api_tests/test_versioning_renamed_from.py +27 -0
- package/generator/test/generic_mock_api_tests/test_versioning_return_type_changed_from.py +17 -0
- package/generator/test/generic_mock_api_tests/test_versioning_type_changed_from.py +21 -0
- package/generator/test/generic_mock_api_tests/unittests/test_model_base_serialization.py +4067 -0
- package/generator/test/generic_mock_api_tests/unittests/test_model_base_xml_serialization.py +1001 -0
- package/generator/test/unbranded/mock_api_tests/asynctests/test_unbranded_async.py +24 -0
- package/generator/test/unbranded/mock_api_tests/cadl-ranch-config.yaml +27 -0
- package/generator/test/unbranded/mock_api_tests/conftest.py +35 -0
- package/generator/test/unbranded/mock_api_tests/test_unbranded.py +57 -0
- package/generator/test/unbranded/requirements.txt +72 -0
- package/generator/test/unbranded/tox.ini +56 -0
- package/package.json +93 -0
|
@@ -0,0 +1,331 @@
|
|
|
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 routes.aio import RoutesClient
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@pytest.fixture
|
|
11
|
+
async def client():
|
|
12
|
+
async with RoutesClient() as client:
|
|
13
|
+
yield client
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@pytest.mark.asyncio
|
|
17
|
+
async def test_fixed(client: RoutesClient):
|
|
18
|
+
await client.fixed()
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@pytest.mark.asyncio
|
|
22
|
+
async def test_in_interface_fixed(client: RoutesClient):
|
|
23
|
+
await client.in_interface.fixed()
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@pytest.mark.asyncio
|
|
27
|
+
async def test_path_parameters_template_only(client: RoutesClient):
|
|
28
|
+
await client.path_parameters.template_only(
|
|
29
|
+
param="a",
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@pytest.mark.asyncio
|
|
34
|
+
async def test_path_parameters_explicit(client: RoutesClient):
|
|
35
|
+
await client.path_parameters.explicit(
|
|
36
|
+
param="a",
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@pytest.mark.asyncio
|
|
41
|
+
async def test_path_parameters_annotation_only(client: RoutesClient):
|
|
42
|
+
await client.path_parameters.annotation_only(
|
|
43
|
+
param="a",
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
@pytest.mark.asyncio
|
|
48
|
+
async def test_path_parameters_reserved_expansion_template(client: RoutesClient):
|
|
49
|
+
await client.path_parameters.reserved_expansion.template(
|
|
50
|
+
param="foo/bar baz",
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
@pytest.mark.asyncio
|
|
55
|
+
async def test_path_parameters_reserved_expansion_annotation(client: RoutesClient):
|
|
56
|
+
await client.path_parameters.reserved_expansion.annotation(
|
|
57
|
+
param="foo/bar baz",
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
# @pytest.mark.asyncio
|
|
62
|
+
# async def test_path_parameters_simple_expansion_standard_primitive(client: RoutesClient):
|
|
63
|
+
# await client.path_parameters.simple_expansion.standard.primitive(
|
|
64
|
+
# param="a",
|
|
65
|
+
# )
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
# @pytest.mark.asyncio
|
|
69
|
+
# async def test_path_parameters_simple_expansion_standard_array(client: RoutesClient):
|
|
70
|
+
# await client.path_parameters.simple_expansion.standard.array(
|
|
71
|
+
# param=["a", "b"],
|
|
72
|
+
# )
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
# @pytest.mark.asyncio
|
|
76
|
+
# async def test_path_parameters_simple_expansion_standard_record(client: RoutesClient):
|
|
77
|
+
# await client.path_parameters.simple_expansion.standard.record(
|
|
78
|
+
# param={"a": 1, "b": 2},
|
|
79
|
+
# )
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
# @pytest.mark.asyncio
|
|
83
|
+
# async def test_path_parameters_simple_expansion_explode_primitive(client: RoutesClient):
|
|
84
|
+
# await client.path_parameters.simple_expansion.explode.primitive(
|
|
85
|
+
# param="a",
|
|
86
|
+
# )
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
# @pytest.mark.asyncio
|
|
90
|
+
# async def test_path_parameters_simple_expansion_explode_array(client: RoutesClient):
|
|
91
|
+
# await client.path_parameters.simple_expansion.explode.array(
|
|
92
|
+
# param=["a", "b"],
|
|
93
|
+
# )
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
# @pytest.mark.asyncio
|
|
97
|
+
# async def test_path_parameters_simple_expansion_explode_record(client: RoutesClient):
|
|
98
|
+
# await client.path_parameters.simple_expansion.explode.record(
|
|
99
|
+
# param={"a": 1, "b": 2},
|
|
100
|
+
# )
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
# @pytest.mark.asyncio
|
|
104
|
+
# async def test_path_parameters_path_expansion_standard_primitive(client: RoutesClient):
|
|
105
|
+
# await client.path_parameters.path_expansion.standard.primitive(
|
|
106
|
+
# param="a",
|
|
107
|
+
# )
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
# @pytest.mark.asyncio
|
|
111
|
+
# async def test_path_parameters_path_expansion_standard_array(client: RoutesClient):
|
|
112
|
+
# await client.path_parameters.path_expansion.standard.array(
|
|
113
|
+
# param=["a", "b"],
|
|
114
|
+
# )
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
# @pytest.mark.asyncio
|
|
118
|
+
# async def test_path_parameters_path_expansion_standard_record(client: RoutesClient):
|
|
119
|
+
# await client.path_parameters.path_expansion.standard.record(
|
|
120
|
+
# param={"a": 1, "b": 2},
|
|
121
|
+
# )
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
# @pytest.mark.asyncio
|
|
125
|
+
# async def test_path_parameters_path_expansion_explode_primitive(client: RoutesClient):
|
|
126
|
+
# await client.path_parameters.path_expansion.explode.primitive(
|
|
127
|
+
# param="a",
|
|
128
|
+
# )
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
# @pytest.mark.asyncio
|
|
132
|
+
# async def test_path_parameters_path_expansion_explode_array(client: RoutesClient):
|
|
133
|
+
# await client.path_parameters.path_expansion.explode.array(
|
|
134
|
+
# param=["a", "b"],
|
|
135
|
+
# )
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
# @pytest.mark.asyncio
|
|
139
|
+
# async def test_path_parameters_path_expansion_explode_record(client: RoutesClient):
|
|
140
|
+
# await client.path_parameters.path_expansion.explode.record(
|
|
141
|
+
# param={"a": 1, "b": 2},
|
|
142
|
+
# )
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
# @pytest.mark.asyncio
|
|
146
|
+
# async def test_path_parameters_label_expansion_standard_primitive(client: RoutesClient):
|
|
147
|
+
# await client.path_parameters.label_expansion.standard.primitive(
|
|
148
|
+
# param="a",
|
|
149
|
+
# )
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
# @pytest.mark.asyncio
|
|
153
|
+
# async def test_path_parameters_label_expansion_standard_array(client: RoutesClient):
|
|
154
|
+
# await client.path_parameters.label_expansion.standard.array(
|
|
155
|
+
# param=["a", "b"],
|
|
156
|
+
# )
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
# @pytest.mark.asyncio
|
|
160
|
+
# async def test_path_parameters_label_expansion_standard_record(client: RoutesClient):
|
|
161
|
+
# await client.path_parameters.label_expansion.standard.record(
|
|
162
|
+
# param={"a": 1, "b": 2},
|
|
163
|
+
# )
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
# @pytest.mark.asyncio
|
|
167
|
+
# async def test_path_parameters_label_expansion_explode_primitive(client: RoutesClient):
|
|
168
|
+
# await client.path_parameters.label_expansion.explode.primitive(
|
|
169
|
+
# param="a",
|
|
170
|
+
# )
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
# @pytest.mark.asyncio
|
|
174
|
+
# async def test_path_parameters_label_expansion_explode_array(client: RoutesClient):
|
|
175
|
+
# await client.path_parameters.label_expansion.explode.array(
|
|
176
|
+
# param=["a", "b"],
|
|
177
|
+
# )
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
# @pytest.mark.asyncio
|
|
181
|
+
# async def test_path_parameters_label_expansion_explode_record(client: RoutesClient):
|
|
182
|
+
# await client.path_parameters.label_expansion.explode.record(
|
|
183
|
+
# param={"a": 1, "b": 2},
|
|
184
|
+
# )
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
# @pytest.mark.asyncio
|
|
188
|
+
# async def test_path_parameters_matrix_expansion_standard_primitive(client: RoutesClient):
|
|
189
|
+
# await client.path_parameters.matrix_expansion.standard.primitive(
|
|
190
|
+
# param="a",
|
|
191
|
+
# )
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
# @pytest.mark.asyncio
|
|
195
|
+
# async def test_path_parameters_matrix_expansion_standard_array(client: RoutesClient):
|
|
196
|
+
# await client.path_parameters.matrix_expansion.standard.array(
|
|
197
|
+
# param=["a", "b"],
|
|
198
|
+
# )
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
# @pytest.mark.asyncio
|
|
202
|
+
# async def test_path_parameters_matrix_expansion_standard_record(client: RoutesClient):
|
|
203
|
+
# await client.path_parameters.matrix_expansion.standard.record(
|
|
204
|
+
# param={"a": 1, "b": 2},
|
|
205
|
+
# )
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
# @pytest.mark.asyncio
|
|
209
|
+
# async def test_path_parameters_matrix_expansion_explode_primitive(client: RoutesClient):
|
|
210
|
+
# await client.path_parameters.matrix_expansion.explode.primitive(
|
|
211
|
+
# param="a",
|
|
212
|
+
# )
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
# @pytest.mark.asyncio
|
|
216
|
+
# async def test_path_parameters_matrix_expansion_explode_array(client: RoutesClient):
|
|
217
|
+
# await client.path_parameters.matrix_expansion.explode.array(
|
|
218
|
+
# param=["a", "b"],
|
|
219
|
+
# )
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
# @pytest.mark.asyncio
|
|
223
|
+
# async def test_path_parameters_matrix_expansion_explode_record(client: RoutesClient):
|
|
224
|
+
# await client.path_parameters.matrix_expansion.explode.record(
|
|
225
|
+
# param={"a": 1, "b": 2},
|
|
226
|
+
# )
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
@pytest.mark.asyncio
|
|
230
|
+
async def test_query_parameters_template_only(client: RoutesClient):
|
|
231
|
+
await client.query_parameters.template_only(
|
|
232
|
+
param="a",
|
|
233
|
+
)
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
@pytest.mark.asyncio
|
|
237
|
+
async def test_query_parameters_explicit(client: RoutesClient):
|
|
238
|
+
await client.query_parameters.explicit(
|
|
239
|
+
param="a",
|
|
240
|
+
)
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
@pytest.mark.asyncio
|
|
244
|
+
async def test_query_parameters_annotation_only(client: RoutesClient):
|
|
245
|
+
await client.query_parameters.annotation_only(
|
|
246
|
+
param="a",
|
|
247
|
+
)
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
@pytest.mark.asyncio
|
|
251
|
+
async def test_query_parameters_query_expansion_standard_primitive(client: RoutesClient):
|
|
252
|
+
await client.query_parameters.query_expansion.standard.primitive(
|
|
253
|
+
param="a",
|
|
254
|
+
)
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
# @pytest.mark.asyncio
|
|
258
|
+
# async def test_query_parameters_query_expansion_standard_array(client: RoutesClient):
|
|
259
|
+
# await client.query_parameters.query_expansion.standard.array(
|
|
260
|
+
# param=["a", "b"],
|
|
261
|
+
# )
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
# @pytest.mark.asyncio
|
|
265
|
+
# async def test_query_parameters_query_expansion_standard_record(client: RoutesClient):
|
|
266
|
+
# await client.query_parameters.query_expansion.standard.record(
|
|
267
|
+
# param={"a": 1, "b": 2},
|
|
268
|
+
# )
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
@pytest.mark.asyncio
|
|
272
|
+
async def test_query_parameters_query_expansion_explode_primitive(client: RoutesClient):
|
|
273
|
+
await client.query_parameters.query_expansion.explode.primitive(
|
|
274
|
+
param="a",
|
|
275
|
+
)
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
# @pytest.mark.asyncio
|
|
279
|
+
# async def test_query_parameters_query_expansion_explode_array(client: RoutesClient):
|
|
280
|
+
# await client.query_parameters.query_expansion.explode.array(
|
|
281
|
+
# param=["a", "b"],
|
|
282
|
+
# )
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
# @pytest.mark.asyncio
|
|
286
|
+
# async def test_query_parameters_query_expansion_explode_record(client: RoutesClient):
|
|
287
|
+
# await client.query_parameters.query_expansion.explode.record(
|
|
288
|
+
# param={"a": 1, "b": 2},
|
|
289
|
+
# )
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
@pytest.mark.asyncio
|
|
293
|
+
async def test_query_parameters_query_continuation_standard_primitive(client: RoutesClient):
|
|
294
|
+
await client.query_parameters.query_continuation.standard.primitive(
|
|
295
|
+
param="a",
|
|
296
|
+
)
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
# @pytest.mark.asyncio
|
|
300
|
+
# async def test_query_parameters_query_continuation_standard_array(client: RoutesClient):
|
|
301
|
+
# await client.query_parameters.query_continuation.standard.array(
|
|
302
|
+
# param=["a", "b"],
|
|
303
|
+
# )
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
# @pytest.mark.asyncio
|
|
307
|
+
# async def test_query_parameters_query_continuation_standard_record(client: RoutesClient):
|
|
308
|
+
# await client.query_parameters.query_continuation.standard.record(
|
|
309
|
+
# param={"a": 1, "b": 2},
|
|
310
|
+
# )
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
@pytest.mark.asyncio
|
|
314
|
+
async def test_query_parameters_query_continuation_explode_primitive(client: RoutesClient):
|
|
315
|
+
await client.query_parameters.query_continuation.explode.primitive(
|
|
316
|
+
param="a",
|
|
317
|
+
)
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
# @pytest.mark.asyncio
|
|
321
|
+
# async def test_query_parameters_query_continuation_explode_array(client: RoutesClient):
|
|
322
|
+
# await client.query_parameters.query_continuation.explode.array(
|
|
323
|
+
# param=["a", "b"],
|
|
324
|
+
# )
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
# @pytest.mark.asyncio
|
|
328
|
+
# async def test_query_parameters_query_continuation_explode_record(client: RoutesClient):
|
|
329
|
+
# await client.query_parameters.query_continuation.explode.record(
|
|
330
|
+
# param={"a": 1, "b": 2},
|
|
331
|
+
# )
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
package/generator/test/generic_mock_api_tests/asynctests/test_server_endpoint_not_defined_async.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
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 server.endpoint.notdefined.aio import NotDefinedClient
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@pytest.fixture
|
|
11
|
+
async def client():
|
|
12
|
+
async with NotDefinedClient(endpoint="http://localhost:3000") as client:
|
|
13
|
+
yield client
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@pytest.mark.asyncio
|
|
17
|
+
async def test_valid(client: NotDefinedClient):
|
|
18
|
+
assert await client.valid() is True
|
|
@@ -0,0 +1,25 @@
|
|
|
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 server.path.multiple.aio import MultipleClient
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@pytest.fixture
|
|
11
|
+
async def client():
|
|
12
|
+
async with MultipleClient(endpoint="http://localhost:3000") as client:
|
|
13
|
+
yield client
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@pytest.mark.asyncio
|
|
17
|
+
async def test_no_operation_params(client: MultipleClient):
|
|
18
|
+
# await client.no_operation_params()
|
|
19
|
+
pass
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@pytest.mark.asyncio
|
|
23
|
+
async def test_with_operation_path_param(client: MultipleClient):
|
|
24
|
+
# await client.with_operation_path_param(keyword="test")
|
|
25
|
+
pass
|
|
@@ -0,0 +1,18 @@
|
|
|
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 server.path.single.aio import SingleClient
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@pytest.fixture
|
|
11
|
+
async def client():
|
|
12
|
+
async with SingleClient(endpoint="http://localhost:3000") as client:
|
|
13
|
+
yield client
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@pytest.mark.asyncio
|
|
17
|
+
async def test_my_op(client):
|
|
18
|
+
assert await client.my_op() is True
|
package/generator/test/generic_mock_api_tests/asynctests/test_server_versions_not_versioned_async.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
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 server.versions.notversioned.aio import NotVersionedClient
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@pytest.fixture
|
|
11
|
+
async def client():
|
|
12
|
+
async with NotVersionedClient(endpoint="http://localhost:3000", api_version="v1.0") as client:
|
|
13
|
+
yield client
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@pytest.mark.asyncio
|
|
17
|
+
async def test_without_api_version(client: NotVersionedClient):
|
|
18
|
+
await client.without_api_version()
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@pytest.mark.asyncio
|
|
22
|
+
async def test_with_query_api_version(client: NotVersionedClient):
|
|
23
|
+
await client.with_query_api_version()
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@pytest.mark.asyncio
|
|
27
|
+
async def test_with_path_api_version(client: NotVersionedClient):
|
|
28
|
+
await client.with_path_api_version()
|
package/generator/test/generic_mock_api_tests/asynctests/test_server_versions_versioned_async.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
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 server.versions.versioned.aio import VersionedClient
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@pytest.fixture
|
|
11
|
+
async def client():
|
|
12
|
+
async with VersionedClient(endpoint="http://localhost:3000") as client:
|
|
13
|
+
yield client
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@pytest.mark.asyncio
|
|
17
|
+
async def test_without_api_version(client: VersionedClient):
|
|
18
|
+
await client.without_api_version()
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@pytest.mark.asyncio
|
|
22
|
+
async def test_with_query_api_version(client: VersionedClient):
|
|
23
|
+
await client.with_query_api_version()
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@pytest.mark.asyncio
|
|
27
|
+
async def test_with_path_api_version(client: VersionedClient):
|
|
28
|
+
await client.with_path_api_version()
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@pytest.mark.asyncio
|
|
32
|
+
async def test_with_query_old_api_version():
|
|
33
|
+
async with VersionedClient(endpoint="http://localhost:3000", api_version="2021-01-01-preview") as client:
|
|
34
|
+
await client.with_query_old_api_version()
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
import datetime
|
|
8
|
+
from specialheaders.conditionalrequest.aio import ConditionalRequestClient
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@pytest.fixture
|
|
12
|
+
async def client():
|
|
13
|
+
async with ConditionalRequestClient() as client:
|
|
14
|
+
yield client
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@pytest.mark.asyncio
|
|
18
|
+
async def test_post_if_match(core_library, client: ConditionalRequestClient):
|
|
19
|
+
await client.post_if_match(etag="valid", match_condition=core_library.MatchConditions.IfNotModified)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@pytest.mark.asyncio
|
|
23
|
+
async def test_post_if_none_match(core_library, client: ConditionalRequestClient):
|
|
24
|
+
await client.post_if_none_match(etag="invalid", match_condition=core_library.MatchConditions.IfModified)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@pytest.mark.asyncio
|
|
28
|
+
async def test_head_if_modified_since(client: ConditionalRequestClient):
|
|
29
|
+
await client.head_if_modified_since(
|
|
30
|
+
if_modified_since=datetime.datetime(2022, 8, 26, 14, 38, 0, tzinfo=datetime.timezone.utc)
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@pytest.mark.asyncio
|
|
35
|
+
async def test_post_if_unmodified_since(client: ConditionalRequestClient):
|
|
36
|
+
await client.post_if_unmodified_since(
|
|
37
|
+
if_unmodified_since=datetime.datetime(2022, 8, 26, 14, 38, 0, tzinfo=datetime.timezone.utc)
|
|
38
|
+
)
|
package/generator/test/generic_mock_api_tests/asynctests/test_special_headers_repeatability_async.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
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 specialheaders.repeatability.aio import RepeatabilityClient
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@pytest.fixture
|
|
11
|
+
async def client():
|
|
12
|
+
async with RepeatabilityClient() as client:
|
|
13
|
+
yield client
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@pytest.mark.asyncio
|
|
17
|
+
async def test_immediate_success(client: RepeatabilityClient):
|
|
18
|
+
cls = lambda x, y, z: z
|
|
19
|
+
assert (await client.immediate_success(cls=cls))["Repeatability-Result"] == "accepted"
|
|
@@ -0,0 +1,42 @@
|
|
|
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"))
|