From f3d33d62f051bc42c954b81c278730d318fd1295 Mon Sep 17 00:00:00 2001 From: iscai-msft <43154838+iscai-msft@users.noreply.github.com> Date: Thu, 3 Mar 2022 14:13:34 -0500 Subject: [PATCH] don't reformat query params for dpg next link calls (#1168) --- ChangeLog.md | 270 ++++++------- autorest/codegen/__init__.py | 7 + autorest/codegen/models/__init__.py | 3 +- .../codegen/serializers/builder_serializer.py | 14 + tasks.py | 1 + .../AcceptanceTests/Paging/paging/_patch.py | 44 +-- .../Paging/paging/aio/_patch.py | 18 +- .../aio/operations/_paging_operations.py | 1 - .../paging/operations/_paging_operations.py | 1 - .../_storage_accounts_operations.py | 2 - .../_storage_accounts_operations.py | 2 - .../AcceptanceTests/asynctests/test_paging.py | 356 +++++++++--------- .../AcceptanceTests/test_paging.py | 6 + .../AcceptanceTests/test_zzz.py | 2 - .../aio/operations/_operations.py | 4 +- .../operations/_operations.py | 4 +- .../aio/operations/_operations.py | 4 +- .../operations/_operations.py | 4 +- .../aio/operations/_operations.py | 2 - .../operations/_operations.py | 2 - .../AcceptanceTests/test_complex.py | 2 +- 21 files changed, 356 insertions(+), 393 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 66f20c7bac7..181754ada28 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -2,21 +2,23 @@ ### 2022-03-03 - 5.13.0 -| Library | Min Version -| --------------- | ------- -|`@autorest/core` | `3.6.2` -|`@autorest/modelerfour` | `4.19.1` -|`azure-core` dep of generated code | `1.20.1` -|`msrest` dep of generated code | `0.6.21` -|`azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` +| Library | Min Version | +| ----------------------------------------------------------------------- | ----------- | +| `@autorest/core` | `3.6.2` | +| `@autorest/modelerfour` | `4.19.1` | +| `azure-core` dep of generated code | `1.20.1` | +| `msrest` dep of generated code | `0.6.21` | +| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` | **Breaking Changes in Version Tolerant Generation** - We now generate with optional constant parameters as None by defaulting `--default-optional-constants-to-none` to True #1171 +- Version tolerant paging does not reformat initial query parameters into the next link #1168 **New Features** - Add flag `--default-optional-constants-to-none` with which optional constant parameters is default to None #1171 +- Add flag `--reformat-next-link`, determines whether we reformat initial query parameters into the next link. Defaults to `True` for the GA generator, forced to `False` for `--version-tolerant`. **Bug Fixes** @@ -29,13 +31,13 @@ ### 2022-02-09 - 5.12.6 -| Library | Min Version -| --------------- | ------- -|`@autorest/core` | `3.6.2` -|`@autorest/modelerfour` | `4.19.1` -|`azure-core` dep of generated code | `1.20.1` -|`msrest` dep of generated code | `0.6.21` -|`azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` +| Library | Min Version | +| ----------------------------------------------------------------------- | ----------- | +| `@autorest/core` | `3.6.2` | +| `@autorest/modelerfour` | `4.19.1` | +| `azure-core` dep of generated code | `1.20.1` | +| `msrest` dep of generated code | `0.6.21` | +| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` | **Bug Fixes** @@ -45,57 +47,57 @@ ### 2022-01-26 - 5.12.5 -| Library | Min Version -| --------------- | ------- -|`@autorest/core` | `3.6.2` -|`@autorest/modelerfour` | `4.19.1` -|`azure-core` dep of generated code | `1.20.1` -|`msrest` dep of generated code | `0.6.21` -|`azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` +| Library | Min Version | +| ----------------------------------------------------------------------- | ----------- | +| `@autorest/core` | `3.6.2` | +| `@autorest/modelerfour` | `4.19.1` | +| `azure-core` dep of generated code | `1.20.1` | +| `msrest` dep of generated code | `0.6.21` | +| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` | **Bug Fixes** -- Fix usage of `--black` flag outside of repo #1126 -- Remove unused `metadata` value for `version-tolerant` generations #1127 +- Fix usage of `--black` flag outside of repo #1126 +- Remove unused `metadata` value for `version-tolerant` generations #1127 ### 2022-01-14 - 5.12.4 -| Library | Min Version -| --------------- | ------- -|`@autorest/core` | `3.6.2` -|`@autorest/modelerfour` | `4.19.1` -|`azure-core` dep of generated code | `1.20.1` -|`msrest` dep of generated code | `0.6.21` -|`azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` +| Library | Min Version | +| ----------------------------------------------------------------------- | ----------- | +| `@autorest/core` | `3.6.2` | +| `@autorest/modelerfour` | `4.19.1` | +| `azure-core` dep of generated code | `1.20.1` | +| `msrest` dep of generated code | `0.6.21` | +| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` | **Bug Fixes** -- Remove duplicate generation of properties in classes that inherit from multiple classes #1120 +- Remove duplicate generation of properties in classes that inherit from multiple classes #1120 ### 2022-01-13 - 5.12.3 -| Library | Min Version -| --------------- | ------- -|`@autorest/core` | `3.6.2` -|`@autorest/modelerfour` | `4.19.1` -|`azure-core` dep of generated code | `1.20.1` -|`msrest` dep of generated code | `0.6.21` -|`azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` +| Library | Min Version | +| ----------------------------------------------------------------------- | ----------- | +| `@autorest/core` | `3.6.2` | +| `@autorest/modelerfour` | `4.19.1` | +| `azure-core` dep of generated code | `1.20.1` | +| `msrest` dep of generated code | `0.6.21` | +| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` | **Bug Fixes** -- Unify multiapi constant behavior with single API version #1119 -- Clean up docstrings by removing descriptions for client constants on methods and request builders #1119 +- Unify multiapi constant behavior with single API version #1119 +- Clean up docstrings by removing descriptions for client constants on methods and request builders #1119 ### 2022-01-11 - 5.12.2 -| Library | Min Version -| --------------- | ------- -|`@autorest/core` | `3.6.2` -|`@autorest/modelerfour` | `4.19.1` -|`azure-core` dep of generated code | `1.20.1` -|`msrest` dep of generated code | `0.6.21` -|`azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` +| Library | Min Version | +| ----------------------------------------------------------------------- | ----------- | +| `@autorest/core` | `3.6.2` | +| `@autorest/modelerfour` | `4.19.1` | +| `azure-core` dep of generated code | `1.20.1` | +| `msrest` dep of generated code | `0.6.21` | +| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` | **Bug Fixes** @@ -103,81 +105,81 @@ ### 2022-01-10 - 5.12.1 -| Library | Min Version -| --------------- | ------- -|`@autorest/core` | `3.6.2` -|`@autorest/modelerfour` | `4.19.1` -|`azure-core` dep of generated code | `1.20.1` -|`msrest` dep of generated code | `0.6.21` -|`azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` +| Library | Min Version | +| ----------------------------------------------------------------------- | ----------- | +| `@autorest/core` | `3.6.2` | +| `@autorest/modelerfour` | `4.19.1` | +| `azure-core` dep of generated code | `1.20.1` | +| `msrest` dep of generated code | `0.6.21` | +| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` | **Bug Fixes** -- Fix support for json merge patch #1117 +- Fix support for json merge patch #1117 ### 2021-12-06 - 5.12.0 -| Library | Min Version -| --------------- | ------- -|`@autorest/core` | `3.6.2` -|`@autorest/modelerfour` | `4.19.1` -|`azure-core` dep of generated code | `1.20.1` -|`msrest` dep of generated code | `0.6.21` -|`azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` +| Library | Min Version | +| ----------------------------------------------------------------------- | ----------- | +| `@autorest/core` | `3.6.2` | +| `@autorest/modelerfour` | `4.19.1` | +| `azure-core` dep of generated code | `1.20.1` | +| `msrest` dep of generated code | `0.6.21` | +| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` | **Breaking Changes in Version Tolerant Generation** - Remove metadata property for version tolerant and low level client generations #1090 -- Generate SDKs with `--python3-only` defaulting to `True` for version tolerant and low level client #1087 +- Generate SDKs with `--python3-only` defaulting to `True` for version tolerant and low level client #1087 **New Features** -- Generate a `_patch.py` file if one does not exist. These files are used to customize the generated code #1092 +- Generate a `_patch.py` file if one does not exist. These files are used to customize the generated code #1092 **Bug Fixes** - Can now handle body params with names `json`, `content`, `data`, and `files` #1081 -- Improve generated templates for `data` and `files` input body params by adding quotes around the keys #1082 -- Using flag `--python3-only` will get you typed sync client and config files #1085 -- Pin `mistune` dependency to less than `2.x.x` so autorest can be successfully installed #1106 +- Improve generated templates for `data` and `files` input body params by adding quotes around the keys #1082 +- Using flag `--python3-only` will get you typed sync client and config files #1085 +- Pin `mistune` dependency to less than `2.x.x` so autorest can be successfully installed #1106 ### 2021-11-05 - 5.11.2 -| Library | Min Version -| --------------- | ------- -|`@autorest/core` | `3.6.2` -|`@autorest/modelerfour` | `4.19.1` -|`azure-core` dep of generated code | `1.20.0` -|`msrest` dep of generated code | `0.6.21` -|`azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` +| Library | Min Version | +| ----------------------------------------------------------------------- | ----------- | +| `@autorest/core` | `3.6.2` | +| `@autorest/modelerfour` | `4.19.1` | +| `azure-core` dep of generated code | `1.20.0` | +| `msrest` dep of generated code | `0.6.21` | +| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` | **Bug Fixes** -- Respect no client side validation for low level client generations #1080 +- Respect no client side validation for low level client generations #1080 ### 2021-11-05 - 5.11.1 -| Library | Min Version -| --------------- | ------- -|`@autorest/core` | `3.6.2` -|`@autorest/modelerfour` | `4.19.1` -|`azure-core` dep of generated code | `1.20.0` -|`msrest` dep of generated code | `0.6.21` -|`azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` +| Library | Min Version | +| ----------------------------------------------------------------------- | ----------- | +| `@autorest/core` | `3.6.2` | +| `@autorest/modelerfour` | `4.19.1` | +| `azure-core` dep of generated code | `1.20.0` | +| `msrest` dep of generated code | `0.6.21` | +| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` | **Bug Fixes** -- Hide mixin operations for version tolerant generation #1071 +- Hide mixin operations for version tolerant generation #1071 ### 2021-11-04 - 5.11.0 -| Library | Min Version -| --------------- | ------- -|`@autorest/core` | `3.6.2` -|`@autorest/modelerfour` | `4.19.1` -|`azure-core` dep of generated code | `1.20.0` -|`msrest` dep of generated code | `0.6.21` -|`azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` +| Library | Min Version | +| ----------------------------------------------------------------------- | ----------- | +| `@autorest/core` | `3.6.2` | +| `@autorest/modelerfour` | `4.19.1` | +| `azure-core` dep of generated code | `1.20.0` | +| `msrest` dep of generated code | `0.6.21` | +| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` | **New Features** @@ -191,68 +193,69 @@ ### 2021-11-01 - 5.10.0 -| Library | Min Version -| --------------- | ------- -|`@autorest/core` | `3.6.2` -|`@autorest/modelerfour` | `4.19.1` -|`azure-core` dep of generated code | `1.19.1` -|`msrest` dep of generated code | `0.6.21` -|`azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` +| Library | Min Version | +| ----------------------------------------------------------------------- | ----------- | +| `@autorest/core` | `3.6.2` | +| `@autorest/modelerfour` | `4.19.1` | +| `azure-core` dep of generated code | `1.19.1` | +| `msrest` dep of generated code | `0.6.21` | +| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` | **New Features** -- Allow users to override constant swagger params with kwarg input #1060 +- Allow users to override constant swagger params with kwarg input #1060 ### 2021-10-15 - 5.9.3 -| Library | Min Version -| --------------- | ------- -|`@autorest/core` | `3.6.2` -|`@autorest/modelerfour` | `4.19.1` -|`azure-core` dep of generated code | `1.19.0` -|`msrest` dep of generated code | `0.6.21` -|`azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` +| Library | Min Version | +| ----------------------------------------------------------------------- | ----------- | +| `@autorest/core` | `3.6.2` | +| `@autorest/modelerfour` | `4.19.1` | +| `azure-core` dep of generated code | `1.19.0` | +| `msrest` dep of generated code | `0.6.21` | +| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` | **Bug Fixes** -- Fix generation of form-data inputs #1061 +- Fix generation of form-data inputs #1061 ### 2021-10-05 - 5.9.2 -| Library | Min Version -| --------------- | ------- -|`@autorest/core` | `3.6.2` -|`@autorest/modelerfour` | `4.19.1` -|`azure-core` dep of generated code | `1.19.0` -|`msrest` dep of generated code | `0.6.21` -|`azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` +| Library | Min Version | +| ----------------------------------------------------------------------- | ----------- | +| `@autorest/core` | `3.6.2` | +| `@autorest/modelerfour` | `4.19.1` | +| `azure-core` dep of generated code | `1.19.0` | +| `msrest` dep of generated code | `0.6.21` | +| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` | **New Features** + - Updating generated code for `azure-core` release `1.19.0`. ### 2021-09-27 - 5.9.1 -| Library | Min Version -| --------------- | ------- -|`@autorest/core` | `3.6.2` -|`@autorest/modelerfour` | `4.19.1` -|`azure-core` dep of generated code | `1.18.0` -|`msrest` dep of generated code | `0.6.21` -|`azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` +| Library | Min Version | +| ----------------------------------------------------------------------- | ----------- | +| `@autorest/core` | `3.6.2` | +| `@autorest/modelerfour` | `4.19.1` | +| `azure-core` dep of generated code | `1.18.0` | +| `msrest` dep of generated code | `0.6.21` | +| `azure-mgmt-core` dep of generated code (If generating mgmt plane code) | `1.3.0` | **New Features** - We have added a **provisional** `rest` layer to our generated code. We have also added the following **provisional** flags listed [here](https://github.com/Azure/autorest.python/wiki/Generating-Low-Level-Client#generate-a-low-level-client). #875 -- With this new release, we are also dropping support for Python 3.5 + async. #875 +- With this new release, we are also dropping support for Python 3.5 + async. #875 - For mgmt plan SDK, default policy changes from `BearerTokenCredentialPolicy` to `ARMChallengeAuthenticationPolicy`. - We now add tracing by default, the flag `--trace` now defaults to `True` if you have operations. -- Added flag `--python3-only` for users looking to generate SDKs that only support Python 3 #1044 +- Added flag `--python3-only` for users looking to generate SDKs that only support Python 3 #1044 **Bug Fixes** -- Correctly pad operation groups with reserved names with `Operations` #1005 -- Fix the generated docstrings for input kwargs of models #1026 -- Pass pipeline context to `msrest` in `failsafe_deserialize` so `msrest` has access to the context #1030 +- Correctly pad operation groups with reserved names with `Operations` #1005 +- Fix the generated docstrings for input kwargs of models #1026 +- Pass pipeline context to `msrest` in `failsafe_deserialize` so `msrest` has access to the context #1030 ### 2021-09-27 - 5.9.0 @@ -287,7 +290,7 @@ min Modelerfour version: 4.19.1 **Bug Fixes** -- We are now more lenient with our checks for the content type parameter #956 +- We are now more lenient with our checks for the content type parameter #956 ### 2021-06-16 - 5.8.1 @@ -298,7 +301,7 @@ min Modelerfour version: 4.19.1 **Bug Fixes** - Fix optional properties with constant schemas. Now, properties that have constant schemas but are optional will not have the hardcoded constant value, -but will default to its `x-ms-client-default` or `None` #952 + but will default to its `x-ms-client-default` or `None` #952 ### 2021-05-17 - 5.8.0 @@ -308,7 +311,7 @@ min Modelerfour version: 4.19.1 **New Features** -- Add support for parameters and properties that can be of type "Anything". #946 +- Add support for parameters and properties that can be of type "Anything". #946 ### 2021-04-20 - 5.7.0 @@ -328,7 +331,7 @@ min Modelerfour version: 4.15.456 **Bug Fixes** -- Fix docstrings so they don't get split on hyphens #931 +- Fix docstrings so they don't get split on hyphens #931 ### 2021-04-07 - 5.6.5 @@ -338,7 +341,7 @@ min Modelerfour version: 4.15.456 **Bug Fixes** -- Fix regression in multiapi generation for multiapi versions without mixin operations #928 +- Fix regression in multiapi generation for multiapi versions without mixin operations #928 ### 2021-03-01 - 5.6.4 @@ -347,6 +350,7 @@ min Autorest core version: 3.1.0 min Modelerfour version: 4.15.456 **Bug Fixes** + - Bump `Autorest core` minimum version to be able to deal with indented `python` blocks in config files ### 2021-02-10 - 5.6.3 @@ -356,7 +360,8 @@ min Autorest core version: 3.0.6372 min Modelerfour version: 4.15.456 **Bug Fixes** -- Bump `Autorest core` minimum version to [correctly deal with](https://github.com/Azure/autorest/pull/3860) overriding configs. Fixes submodule-specific code in our multiapi client #880 + +- Bump `Autorest core` minimum version to [correctly deal with](https://github.com/Azure/autorest/pull/3860) overriding configs. Fixes submodule-specific code in our multiapi client #880 ### 2021-02-04 - 5.6.2 @@ -365,7 +370,8 @@ Autorest core version: 3.0.6318 Modelerfour version: 4.15.456 **Bug Fixes** -- Bump `Modelerfour` minimum version to [correctly deal with](https://github.com/Azure/autorest.modelerfour/pull/385) parameters specified as `'required': false` in swagger #877 + +- Bump `Modelerfour` minimum version to [correctly deal with](https://github.com/Azure/autorest.modelerfour/pull/385) parameters specified as `'required': false` in swagger #877 ### 2021-01-27 - 5.6.1 diff --git a/autorest/codegen/__init__.py b/autorest/codegen/__init__.py index 0e7bab00b83..c00906aec09 100644 --- a/autorest/codegen/__init__.py +++ b/autorest/codegen/__init__.py @@ -76,6 +76,12 @@ def _validate_code_model_options(options: Dict[str, Any]) -> None: "If you want operation files, pass in flag --show-operations" ) + if options["reformat_next_link"] and options["version_tolerant"]: + raise ValueError( + "--reformat-next-link can not be true for version tolerant generations. " + "Please remove --reformat-next-link from your call for version tolerant generations." + ) + _LOGGER = logging.getLogger(__name__) class CodeGenerator(Plugin): @staticmethod @@ -292,6 +298,7 @@ def _build_code_model_options(self) -> Dict[str, Any]: "default_optional_constants_to_none": self._autorestapi.get_boolean_value( "default-optional-constants-to-none", low_level_client or version_tolerant ), + "reformat_next_link": self._autorestapi.get_boolean_value("reformat-next-link", not version_tolerant) } if options["builders_visibility"] is None: diff --git a/autorest/codegen/models/__init__.py b/autorest/codegen/models/__init__.py index b1b7a409606..b2d96fa5c02 100644 --- a/autorest/codegen/models/__init__.py +++ b/autorest/codegen/models/__init__.py @@ -17,7 +17,7 @@ from .imports import FileImport, ImportType, TypingSection from .lro_operation import LROOperation from .paging_operation import PagingOperation -from .parameter import Parameter, ParameterStyle +from .parameter import Parameter, ParameterStyle, ParameterLocation from .operation import Operation from .property import Property from .operation_group import OperationGroup @@ -50,6 +50,7 @@ "PagingOperation", "Parameter", "ParameterList", + "ParameterLocation", "OperationGroup", "Property", "RequestBuilder", diff --git a/autorest/codegen/serializers/builder_serializer.py b/autorest/codegen/serializers/builder_serializer.py index db0d7c445ad..68d3a9a3768 100644 --- a/autorest/codegen/serializers/builder_serializer.py +++ b/autorest/codegen/serializers/builder_serializer.py @@ -27,6 +27,7 @@ SchemaResponse, IOSchema, ParameterStyle, + ParameterLocation ) from . import utils @@ -798,6 +799,7 @@ def _call_request_builder_helper( builder, request_builder: RequestBuilder, template_url: Optional[str] = None, + is_next_request: bool = False, ) -> List[str]: retval = [] if len(builder.body_kwargs_to_pass_to_request_builder) > 1: @@ -837,6 +839,16 @@ def _call_request_builder_helper( parameter.serialized_name not in builder.body_kwargs_to_pass_to_request_builder ): continue + if ( + is_next_request and + not bool(builder.next_request_builder) and + not self.code_model.options["reformat_next_link"] and + parameter.location == ParameterLocation.Query + ): + # if we don't want to reformat query parameters for next link calls + # in paging operations with a single swagger operation defintion, + # we skip passing query params when building the next request + continue high_level_name = cast(RequestBuilderParameter, parameter).name_in_high_level_operation retval.append(f" {parameter.serialized_name}={high_level_name},") if not self.code_model.options["version_tolerant"]: @@ -1083,11 +1095,13 @@ def call_next_link_request_builder(self, builder) -> List[str]: else: request_builder = builder.request_builder template_url = "next_link" + request_builder = builder.next_request_builder or builder.request_builder return self._call_request_builder_helper( builder, request_builder, template_url=template_url, + is_next_request=True ) def _prepare_request_callback(self, builder) -> List[str]: diff --git a/tasks.py b/tasks.py index eb603a6ca60..33b9e6dd415 100644 --- a/tasks.py +++ b/tasks.py @@ -160,6 +160,7 @@ def _build_flags( generation_section += "/legacy" override_flags = override_flags or {} override_flags["payload-flattening-threshold"] = 1 + override_flags["reformat-next-link"] = False flags = { "use": autorest_dir, diff --git a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_patch.py b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_patch.py index 0644979e481..f99e77fef98 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_patch.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/_patch.py @@ -24,50 +24,8 @@ # IN THE SOFTWARE. # # -------------------------------------------------------------------------- -from typing import List -import importlib -from ._auto_rest_paging_test_service import AutoRestPagingTestService as AutoRestPagingTestServiceGenerated -from azure.core.pipeline.policies import SansIOHTTPPolicy - -try: - binary_type = str - import urlparse # type: ignore - from urllib import urlencode -except ImportError: - binary_type = bytes # type: ignore - from urllib import parse as urlparse - from urllib.parse import urlencode - - -class RemoveDuplicateParamsPolicy(SansIOHTTPPolicy): - def __init__(self, duplicate_param_names): - # type: (List[str]) -> None - self.duplicate_param_names = duplicate_param_names - - def on_request(self, request): - parsed_url = urlparse.urlparse(request.http_request.url) - query_params = urlparse.parse_qs(parsed_url.query) - # service returned will be later in the url because of how we format - filtered_query_params = {k: v[-1:] if k in self.duplicate_param_names else v for k, v in query_params.items()} - request.http_request.url = request.http_request.url.replace(parsed_url.query, "") + urlencode( - filtered_query_params, doseq=True - ) - return super(RemoveDuplicateParamsPolicy, self).on_request(request) - - -class AutoRestPagingTestService(AutoRestPagingTestServiceGenerated): - def __init__(self, *args, **kwargs): - per_call_policies = kwargs.pop("per_call_policies", []) - params_policy = RemoveDuplicateParamsPolicy(duplicate_param_names=["$filter", "$skiptoken"]) - try: - per_call_policies.append(params_policy) - except AttributeError: - per_call_policies = [per_call_policies, params_policy] - super(AutoRestPagingTestService, self).__init__(*args, per_call_policies=per_call_policies, **kwargs) - # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - curr_package = importlib.import_module("paging") - curr_package.AutoRestPagingTestService = AutoRestPagingTestService + pass diff --git a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/_patch.py b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/_patch.py index 0638c4f9cbc..f99e77fef98 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/_patch.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/_patch.py @@ -24,24 +24,8 @@ # IN THE SOFTWARE. # # -------------------------------------------------------------------------- -import importlib -from .._patch import RemoveDuplicateParamsPolicy -from ._auto_rest_paging_test_service import AutoRestPagingTestService as AutoRestPagingTestServiceGenerated - - -class AutoRestPagingTestService(AutoRestPagingTestServiceGenerated): - def __init__(self, *args, **kwargs): - per_call_policies = kwargs.pop("per_call_policies", []) - params_policy = RemoveDuplicateParamsPolicy(duplicate_param_names=["$filter", "$skiptoken"]) - try: - per_call_policies.append(params_policy) - except AttributeError: - per_call_policies = [per_call_policies, params_policy] - super().__init__(*args, per_call_policies=per_call_policies, **kwargs) - # This file is used for handwritten extensions to the generated code. Example: # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - curr_package = importlib.import_module("paging.aio") - curr_package.AutoRestPagingTestService = AutoRestPagingTestService + pass diff --git a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/operations/_paging_operations.py b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/operations/_paging_operations.py index 1ce2f0278d5..2b4b90aef67 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/operations/_paging_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/aio/operations/_paging_operations.py @@ -489,7 +489,6 @@ def prepare_request(next_link=None): else: request = build_duplicate_params_request( - filter=filter, template_url=next_link, ) request = _convert_request(request) diff --git a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/operations/_paging_operations.py b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/operations/_paging_operations.py index 3503b23b075..92c3e467e1d 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/operations/_paging_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/Paging/paging/operations/_paging_operations.py @@ -1041,7 +1041,6 @@ def prepare_request(next_link=None): else: request = build_duplicate_params_request( - filter=filter, template_url=next_link, ) request = _convert_request(request) diff --git a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/_storage_accounts_operations.py b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/_storage_accounts_operations.py index c48e49635e2..efbf27fc48c 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/_storage_accounts_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations/_storage_accounts_operations.py @@ -506,7 +506,6 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -577,7 +576,6 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) diff --git a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_storage_accounts_operations.py b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_storage_accounts_operations.py index 65b38e911b8..5aa449234fa 100644 --- a/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_storage_accounts_operations.py +++ b/test/azure/legacy/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_storage_accounts_operations.py @@ -847,7 +847,6 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -921,7 +920,6 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) diff --git a/test/azure/version-tolerant/AcceptanceTests/asynctests/test_paging.py b/test/azure/version-tolerant/AcceptanceTests/asynctests/test_paging.py index 91aad9b6684..d7574fffc63 100644 --- a/test/azure/version-tolerant/AcceptanceTests/asynctests/test_paging.py +++ b/test/azure/version-tolerant/AcceptanceTests/asynctests/test_paging.py @@ -53,178 +53,184 @@ async def custom_url_client(): async with AutoRestParameterizedHostTestPagingClient(host="host:3000") as client: await yield_(client) -class TestPaging(object): - @pytest.mark.asyncio - async def test_get_no_item_name_pages(self, client): - pages = client.paging.get_no_item_name_pages() - items = [] - async for item in pages: - items.append(item) - assert len(items) == 1 - assert items[0]["properties"]["id"] == 1 - assert items[0]["properties"]["name"] == "Product" - - @pytest.mark.asyncio - async def test_get_null_next_link_name_pages(self, client): - pages = client.paging.get_null_next_link_name_pages() - items = [] - async for item in pages: - items.append(item) - assert len(items) == 1 - assert items[0]["properties"]["id"] == 1 - assert items[0]["properties"]["name"] == "Product" - - @pytest.mark.asyncio - async def test_get_single_pages_with_cb(self, client): - def cb(list_of_obj): - for obj in list_of_obj: - obj["marked"] = True - return list_of_obj - async for obj in client.paging.get_single_pages(cls=cb): - assert obj["marked"] - - @pytest.mark.asyncio - async def test_get_single_pages(self, client): - pages = client.paging.get_single_pages() - items = [] - async for item in pages: - items.append(item) - assert len(items) == 1 - assert items[0]["properties"]["id"] == 1 - assert items[0]["properties"]["name"] == "Product" - - @pytest.mark.asyncio - async def test_get_multiple_pages(self, client): - pages = client.paging.get_multiple_pages() - items = [] - async for item in pages: - items.append(item) - assert len(items) == 10 - - @pytest.mark.asyncio - async def test_query_params(self, client): - pages = client.paging.get_with_query_params(required_query_parameter='100') - items = [] - async for item in pages: - items.append(item) - assert len(items) == 2 - - @pytest.mark.asyncio - async def test_get_odata_multiple_pages(self, client): - pages = client.paging.get_odata_multiple_pages() - items = [] - async for item in pages: - items.append(item) - assert len(items) == 10 - - @pytest.mark.asyncio - async def test_get_multiple_pages_retry_first(self, client): - pages = client.paging.get_multiple_pages_retry_first() - items = [] - async for item in pages: - items.append(item) - assert len(items) == 10 - - @pytest.mark.asyncio - async def test_get_multiple_pages_retry_second(self, client): - pages = client.paging.get_multiple_pages_retry_second() - items = [] - async for item in pages: - items.append(item) - assert len(items) == 10 - - @pytest.mark.asyncio - async def test_get_multiple_pages_with_offset(self, client): - pages = client.paging.get_multiple_pages_with_offset(offset=100) - items = [] - async for item in pages: - items.append(item) - assert len(items) == 10 - assert items[-1]["properties"]["id"] == 110 - - @pytest.mark.asyncio - async def test_get_single_pages_failure(self, client): - pages = client.paging.get_single_pages_failure() - with pytest.raises(HttpResponseError): - async for i in pages: - ... - - @pytest.mark.asyncio - async def test_get_multiple_pages_failure(self, client): - pages = client.paging.get_multiple_pages_failure() - with pytest.raises(HttpResponseError): - async for i in pages: - ... - - @pytest.mark.asyncio - async def test_get_multiple_pages_failure_uri(self, client): - pages = client.paging.get_multiple_pages_failure_uri() - with pytest.raises(HttpResponseError): - async for i in pages: - ... - - @pytest.mark.asyncio - async def test_paging_fragment_path(self, client): - - pages = client.paging.get_multiple_pages_fragment_next_link(api_version="1.6", tenant="test_user") - items = [] - async for item in pages: - items.append(item) - assert len(items) == 10 - - with pytest.raises(AttributeError): - # Be sure this method is not generated (Transform work) - await client.paging.get_multiple_pages_fragment_next_link_next() # pylint: disable=E1101 - - @pytest.mark.asyncio - async def test_custom_url_get_pages_partial_url(self, custom_url_client): - pages = custom_url_client.paging.get_pages_partial_url("local") - items = [] - async for item in pages: - items.append(item) - - assert len(items) == 2 - assert items[0]["properties"]["id"] == 1 - assert items[1]["properties"]["id"] == 2 - - @pytest.mark.asyncio - async def test_custom_url_get_pages_partial_url_operation(self, custom_url_client): - pages = custom_url_client.paging.get_pages_partial_url_operation("local") - items = [] - async for item in pages: - items.append(item) - - assert len(items) == 2 - assert items[0]["properties"]["id"] == 1 - assert items[1]["properties"]["id"] == 2 - - @pytest.mark.asyncio - async def test_get_multiple_pages_lro(self, client): - """LRO + Paging at the same time. - """ - from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - poller = await client.paging.begin_get_multiple_pages_lro(polling=AsyncARMPolling(timeout=0)) - pager = await poller.result() - items = [] - async for item in pager: - items.append(item) - - assert len(items) == 10 - assert items[0]["properties"]["id"] == 1 - assert items[1]["properties"]["id"] == 2 - - @pytest.mark.asyncio - async def test_initial_response_no_items(self, client): - pages = client.paging.first_response_empty() - items = [] - async for item in pages: - items.append(item) - assert len(items) == 1 - - @pytest.mark.asyncio - async def test_item_name_with_xms_client_name(self, client): - pages = client.paging.get_paging_model_with_item_name_with_xms_client_name() - items = [] - async for item in pages: - items.append(item) - assert len(items) == 1 +@pytest.mark.asyncio +async def test_get_no_item_name_pages(client): + pages = client.paging.get_no_item_name_pages() + items = [] + async for item in pages: + items.append(item) + assert len(items) == 1 + assert items[0]["properties"]["id"] == 1 + assert items[0]["properties"]["name"] == "Product" + +@pytest.mark.asyncio +async def test_get_null_next_link_name_pages(client): + pages = client.paging.get_null_next_link_name_pages() + items = [] + async for item in pages: + items.append(item) + assert len(items) == 1 + assert items[0]["properties"]["id"] == 1 + assert items[0]["properties"]["name"] == "Product" + +@pytest.mark.asyncio +async def test_get_single_pages_with_cb(client): + def cb(list_of_obj): + for obj in list_of_obj: + obj["marked"] = True + return list_of_obj + async for obj in client.paging.get_single_pages(cls=cb): + assert obj["marked"] + +@pytest.mark.asyncio +async def test_get_single_pages(client): + pages = client.paging.get_single_pages() + items = [] + async for item in pages: + items.append(item) + assert len(items) == 1 + assert items[0]["properties"]["id"] == 1 + assert items[0]["properties"]["name"] == "Product" + +@pytest.mark.asyncio +async def test_get_multiple_pages(client): + pages = client.paging.get_multiple_pages() + items = [] + async for item in pages: + items.append(item) + assert len(items) == 10 + +@pytest.mark.asyncio +async def test_query_params(client): + pages = client.paging.get_with_query_params(required_query_parameter='100') + items = [] + async for item in pages: + items.append(item) + assert len(items) == 2 + +@pytest.mark.asyncio +async def test_get_odata_multiple_pages(client): + pages = client.paging.get_odata_multiple_pages() + items = [] + async for item in pages: + items.append(item) + assert len(items) == 10 + +@pytest.mark.asyncio +async def test_get_multiple_pages_retry_first(client): + pages = client.paging.get_multiple_pages_retry_first() + items = [] + async for item in pages: + items.append(item) + assert len(items) == 10 + +@pytest.mark.asyncio +async def test_get_multiple_pages_retry_second(client): + pages = client.paging.get_multiple_pages_retry_second() + items = [] + async for item in pages: + items.append(item) + assert len(items) == 10 + +@pytest.mark.asyncio +async def test_get_multiple_pages_with_offset(client): + pages = client.paging.get_multiple_pages_with_offset(offset=100) + items = [] + async for item in pages: + items.append(item) + assert len(items) == 10 + assert items[-1]["properties"]["id"] == 110 + +@pytest.mark.asyncio +async def test_get_single_pages_failure(client): + pages = client.paging.get_single_pages_failure() + with pytest.raises(HttpResponseError): + async for i in pages: + ... + +@pytest.mark.asyncio +async def test_get_multiple_pages_failure(client): + pages = client.paging.get_multiple_pages_failure() + with pytest.raises(HttpResponseError): + async for i in pages: + ... + +@pytest.mark.asyncio +async def test_get_multiple_pages_failure_uri(client): + pages = client.paging.get_multiple_pages_failure_uri() + with pytest.raises(HttpResponseError): + async for i in pages: + ... + +@pytest.mark.asyncio +async def test_paging_fragment_path(client): + + pages = client.paging.get_multiple_pages_fragment_next_link(api_version="1.6", tenant="test_user") + items = [] + async for item in pages: + items.append(item) + assert len(items) == 10 + + with pytest.raises(AttributeError): + # Be sure this method is not generated (Transform work) + await client.paging.get_multiple_pages_fragment_next_link_next() # pylint: disable=E1101 + +@pytest.mark.asyncio +async def test_custom_url_get_pages_partial_url(custom_url_client): + pages = custom_url_client.paging.get_pages_partial_url("local") + items = [] + async for item in pages: + items.append(item) + + assert len(items) == 2 + assert items[0]["properties"]["id"] == 1 + assert items[1]["properties"]["id"] == 2 + +@pytest.mark.asyncio +async def test_custom_url_get_pages_partial_url_operation(custom_url_client): + pages = custom_url_client.paging.get_pages_partial_url_operation("local") + items = [] + async for item in pages: + items.append(item) + + assert len(items) == 2 + assert items[0]["properties"]["id"] == 1 + assert items[1]["properties"]["id"] == 2 + +@pytest.mark.asyncio +async def test_get_multiple_pages_lro(client): + """LRO + Paging at the same time. + """ + from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + poller = await client.paging.begin_get_multiple_pages_lro(polling=AsyncARMPolling(timeout=0)) + pager = await poller.result() + items = [] + async for item in pager: + items.append(item) + + assert len(items) == 10 + assert items[0]["properties"]["id"] == 1 + assert items[1]["properties"]["id"] == 2 + +@pytest.mark.asyncio +async def test_initial_response_no_items(client): + pages = client.paging.first_response_empty() + items = [] + async for item in pages: + items.append(item) + assert len(items) == 1 + +@pytest.mark.asyncio +async def test_item_name_with_xms_client_name(client): + pages = client.paging.get_paging_model_with_item_name_with_xms_client_name() + items = [] + async for item in pages: + items.append(item) + assert len(items) == 1 + +@pytest.mark.asyncio +async def test_duplicate_params(client): + pages = [p async for p in client.paging.duplicate_params(filter="foo")] + assert len(pages) == 1 + assert pages[0]["properties"]["id"] == 1 + assert pages[0]["properties"]["name"] == "Product" diff --git a/test/azure/version-tolerant/AcceptanceTests/test_paging.py b/test/azure/version-tolerant/AcceptanceTests/test_paging.py index 407d8918fb0..5ffac65c6c0 100644 --- a/test/azure/version-tolerant/AcceptanceTests/test_paging.py +++ b/test/azure/version-tolerant/AcceptanceTests/test_paging.py @@ -164,3 +164,9 @@ def test_initial_response_no_items(client): pages = client.paging.first_response_empty() items = [i for i in pages] assert len(items) == 1 + +def test_duplicate_params(client): + pages = list(client.paging.duplicate_params(filter="foo")) + assert len(pages) == 1 + assert pages[0]["properties"]["id"] == 1 + assert pages[0]["properties"]["name"] == "Product" diff --git a/test/azure/version-tolerant/AcceptanceTests/test_zzz.py b/test/azure/version-tolerant/AcceptanceTests/test_zzz.py index 1075dbafde8..f50668f381c 100644 --- a/test/azure/version-tolerant/AcceptanceTests/test_zzz.py +++ b/test/azure/version-tolerant/AcceptanceTests/test_zzz.py @@ -37,8 +37,6 @@ def test_ensure_coverage(self): # Add tests that wont be supported due to the nature of Python here not_supported = { - "LROPatchInlineCompleteIgnoreHeaders": 1, - "PagingDuplicateParameters": 1 # skipping for now, going to do another PR soon changing paging behavior for version tolerant } # Please add missing features or failing tests here diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/operations/_operations.py index 37449a9cd81..bf928a57ab8 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/aio/operations/_operations.py @@ -538,9 +538,7 @@ def prepare_request(next_link=None): else: - request = build_paging_duplicate_params_request( - filter=filter, - ) + request = build_paging_duplicate_params_request() request.url = self._client.format_url(next_link) request.method = "GET" return request diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/operations/_operations.py index 1cd8d52d9e0..215f3422282 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/CustomPollerPagerVersionTolerant/custompollerpagerversiontolerant/operations/_operations.py @@ -892,9 +892,7 @@ def prepare_request(next_link=None): else: - request = build_paging_duplicate_params_request( - filter=filter, - ) + request = build_paging_duplicate_params_request() request.url = self._client.format_url(next_link) request.method = "GET" return request diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/operations/_operations.py index 59081d1fea3..1a2a30178c9 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/aio/operations/_operations.py @@ -536,9 +536,7 @@ def prepare_request(next_link=None): else: - request = build_paging_duplicate_params_request( - filter=filter, - ) + request = build_paging_duplicate_params_request() request.url = self._client.format_url(next_link) request.method = "GET" return request diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/operations/_operations.py index 6073dc1e044..205a52f9081 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/PagingVersionTolerant/pagingversiontolerant/operations/_operations.py @@ -890,9 +890,7 @@ def prepare_request(next_link=None): else: - request = build_paging_duplicate_params_request( - filter=filter, - ) + request = build_paging_duplicate_params_request() request.url = self._client.format_url(next_link) request.method = "GET" return request diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/operations/_operations.py index bfbd57166d7..07304d9e4fc 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/aio/operations/_operations.py @@ -843,7 +843,6 @@ def prepare_request(next_link=None): request = build_storage_accounts_list_request( subscription_id=self._config.subscription_id, - api_version=api_version, ) request.url = self._client.format_url(next_link) request.method = "GET" @@ -990,7 +989,6 @@ def prepare_request(next_link=None): request = build_storage_accounts_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, - api_version=api_version, ) request.url = self._client.format_url(next_link) request.method = "GET" diff --git a/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/operations/_operations.py b/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/operations/_operations.py index ce22aa4923f..d43ed7ecfd7 100644 --- a/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/operations/_operations.py +++ b/test/azure/version-tolerant/Expected/AcceptanceTests/StorageManagementClientVersionTolerant/storageversiontolerant/operations/_operations.py @@ -1154,7 +1154,6 @@ def prepare_request(next_link=None): request = build_storage_accounts_list_request( subscription_id=self._config.subscription_id, - api_version=api_version, ) request.url = self._client.format_url(next_link) request.method = "GET" @@ -1301,7 +1300,6 @@ def prepare_request(next_link=None): request = build_storage_accounts_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, - api_version=api_version, ) request.url = self._client.format_url(next_link) request.method = "GET" diff --git a/test/vanilla/version-tolerant/AcceptanceTests/test_complex.py b/test/vanilla/version-tolerant/AcceptanceTests/test_complex.py index 27ea8c9666b..0df996acae8 100644 --- a/test/vanilla/version-tolerant/AcceptanceTests/test_complex.py +++ b/test/vanilla/version-tolerant/AcceptanceTests/test_complex.py @@ -54,7 +54,7 @@ def min_date(): min_date = datetime.min return min_date.replace(tzinfo=UTC()) -def test_basic_get_and_put_valid(client): +def test_basic_get_and_put_valid(client: AutoRestComplexTestService): # GET basic/valid basic_result = client.basic.get_valid() assert 2 == basic_result['id']