From e281d985810889dd5dc1a5db9429806d9a9b1f5e Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Mon, 20 Jul 2020 17:02:58 -0400 Subject: [PATCH 01/10] add code to generate xml text attribute --- README.md | 2 +- autorest/codegen/models/base_schema.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 82537f3dc5d..a3b673c6758 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ AutoRest needs the below config to pick this up as a plug-in - see https://githu pass-thru: - model-deduplicator - subset-reducer -version: 3.0.6287 +version: 3.0.6302 use-extension: "@autorest/modelerfour": "4.15.378" diff --git a/autorest/codegen/models/base_schema.py b/autorest/codegen/models/base_schema.py index de111bc6d6a..f7ed42e11de 100644 --- a/autorest/codegen/models/base_schema.py +++ b/autorest/codegen/models/base_schema.py @@ -46,6 +46,8 @@ def xml_serialization_ctxt(self) -> Optional[str]: attrs_list.append(f"'prefix': '{self.xml_metadata['prefix']}'") if self.xml_metadata.get("namespace", False): attrs_list.append(f"'ns': '{self.xml_metadata['namespace']}'") + if self.xml_metadata.get("extensions", {}).get("x-ms-text", False): + attrs_list.append(f"'text': True") return ", ".join(attrs_list) def imports(self) -> FileImport: # pylint: disable=no-self-use From 69b5d4bfd44de272f42e8f00bedfbf82f8df4562 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Mon, 20 Jul 2020 17:03:16 -0400 Subject: [PATCH 02/10] generate with testserver test --- .../operations_async/_xml_operations_async.py | 43 ++++++++++++++++++ .../Xml/xmlservice/models/__init__.py | 3 ++ .../Xml/xmlservice/models/_models.py | 26 +++++++++++ .../Xml/xmlservice/models/_models_py3.py | 29 ++++++++++++ .../xmlservice/operations/_xml_operations.py | 44 +++++++++++++++++++ 5 files changed, 145 insertions(+) diff --git a/test/vanilla/Expected/AcceptanceTests/Xml/xmlservice/aio/operations_async/_xml_operations_async.py b/test/vanilla/Expected/AcceptanceTests/Xml/xmlservice/aio/operations_async/_xml_operations_async.py index 65b4573cfe6..678dd4db9ee 100644 --- a/test/vanilla/Expected/AcceptanceTests/Xml/xmlservice/aio/operations_async/_xml_operations_async.py +++ b/test/vanilla/Expected/AcceptanceTests/Xml/xmlservice/aio/operations_async/_xml_operations_async.py @@ -1353,3 +1353,46 @@ async def json_output( return deserialized json_output.metadata = {'url': '/xml/jsonoutput'} # type: ignore + + @distributed_trace_async + async def get_xms_text( + self, + **kwargs + ) -> "models.ObjectWithXMsTextProperty": + """Get back an XML object with an x-ms-text property, which should translate to the returned + object's 'language' property being 'english' and its 'content' property being 'I am text'. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ObjectWithXMsTextProperty, or the result of cls(response) + :rtype: ~xmlservice.models.ObjectWithXMsTextProperty + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ObjectWithXMsTextProperty"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + # Construct URL + url = self.get_xms_text.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/xml' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + deserialized = self._deserialize('ObjectWithXMsTextProperty', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_xms_text.metadata = {'url': '/xml/x-ms-text'} # type: ignore diff --git a/test/vanilla/Expected/AcceptanceTests/Xml/xmlservice/models/__init__.py b/test/vanilla/Expected/AcceptanceTests/Xml/xmlservice/models/__init__.py index ff66a269480..28e45ff1757 100644 --- a/test/vanilla/Expected/AcceptanceTests/Xml/xmlservice/models/__init__.py +++ b/test/vanilla/Expected/AcceptanceTests/Xml/xmlservice/models/__init__.py @@ -26,6 +26,7 @@ from ._models_py3 import ListContainersResponse from ._models_py3 import Logging from ._models_py3 import Metrics + from ._models_py3 import ObjectWithXMsTextProperty from ._models_py3 import RetentionPolicy from ._models_py3 import RootWithRefAndMeta from ._models_py3 import RootWithRefAndNoMeta @@ -53,6 +54,7 @@ from ._models import ListContainersResponse # type: ignore from ._models import Logging # type: ignore from ._models import Metrics # type: ignore + from ._models import ObjectWithXMsTextProperty # type: ignore from ._models import RetentionPolicy # type: ignore from ._models import RootWithRefAndMeta # type: ignore from ._models import RootWithRefAndNoMeta # type: ignore @@ -92,6 +94,7 @@ 'ListContainersResponse', 'Logging', 'Metrics', + 'ObjectWithXMsTextProperty', 'RetentionPolicy', 'RootWithRefAndMeta', 'RootWithRefAndNoMeta', diff --git a/test/vanilla/Expected/AcceptanceTests/Xml/xmlservice/models/_models.py b/test/vanilla/Expected/AcceptanceTests/Xml/xmlservice/models/_models.py index b68abeb80d8..f57ad3fae74 100644 --- a/test/vanilla/Expected/AcceptanceTests/Xml/xmlservice/models/_models.py +++ b/test/vanilla/Expected/AcceptanceTests/Xml/xmlservice/models/_models.py @@ -765,6 +765,32 @@ def __init__( self.retention_policy = kwargs.get('retention_policy', None) +class ObjectWithXMsTextProperty(msrest.serialization.Model): + """Contans property. + + :param language: Returned value should be 'english'. + :type language: str + :param content: Returned value should be 'I am text'. + :type content: str + """ + + _attribute_map = { + 'language': {'key': 'language', 'type': 'str', 'xml': {'name': 'language', 'attr': True}}, + 'content': {'key': 'content', 'type': 'str', 'xml': {'text': True}}, + } + _xml_map = { + 'name': 'Data' + } + + def __init__( + self, + **kwargs + ): + super(ObjectWithXMsTextProperty, self).__init__(**kwargs) + self.language = kwargs.get('language', None) + self.content = kwargs.get('content', None) + + class RetentionPolicy(msrest.serialization.Model): """the retention policy. diff --git a/test/vanilla/Expected/AcceptanceTests/Xml/xmlservice/models/_models_py3.py b/test/vanilla/Expected/AcceptanceTests/Xml/xmlservice/models/_models_py3.py index 198e4fde442..a10db29365d 100644 --- a/test/vanilla/Expected/AcceptanceTests/Xml/xmlservice/models/_models_py3.py +++ b/test/vanilla/Expected/AcceptanceTests/Xml/xmlservice/models/_models_py3.py @@ -876,6 +876,35 @@ def __init__( self.retention_policy = retention_policy +class ObjectWithXMsTextProperty(msrest.serialization.Model): + """Contans property. + + :param language: Returned value should be 'english'. + :type language: str + :param content: Returned value should be 'I am text'. + :type content: str + """ + + _attribute_map = { + 'language': {'key': 'language', 'type': 'str', 'xml': {'name': 'language', 'attr': True}}, + 'content': {'key': 'content', 'type': 'str', 'xml': {'text': True}}, + } + _xml_map = { + 'name': 'Data' + } + + def __init__( + self, + *, + language: Optional[str] = None, + content: Optional[str] = None, + **kwargs + ): + super(ObjectWithXMsTextProperty, self).__init__(**kwargs) + self.language = language + self.content = content + + class RetentionPolicy(msrest.serialization.Model): """the retention policy. diff --git a/test/vanilla/Expected/AcceptanceTests/Xml/xmlservice/operations/_xml_operations.py b/test/vanilla/Expected/AcceptanceTests/Xml/xmlservice/operations/_xml_operations.py index d30faf9e485..a4fe784dabe 100644 --- a/test/vanilla/Expected/AcceptanceTests/Xml/xmlservice/operations/_xml_operations.py +++ b/test/vanilla/Expected/AcceptanceTests/Xml/xmlservice/operations/_xml_operations.py @@ -1386,3 +1386,47 @@ def json_output( return deserialized json_output.metadata = {'url': '/xml/jsonoutput'} # type: ignore + + @distributed_trace + def get_xms_text( + self, + **kwargs # type: Any + ): + # type: (...) -> "models.ObjectWithXMsTextProperty" + """Get back an XML object with an x-ms-text property, which should translate to the returned + object's 'language' property being 'english' and its 'content' property being 'I am text'. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ObjectWithXMsTextProperty, or the result of cls(response) + :rtype: ~xmlservice.models.ObjectWithXMsTextProperty + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ObjectWithXMsTextProperty"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + # Construct URL + url = self.get_xms_text.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/xml' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + deserialized = self._deserialize('ObjectWithXMsTextProperty', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_xms_text.metadata = {'url': '/xml/x-ms-text'} # type: ignore From 22ca67ceec0a87aeb3e0addb13c5461ed0a9534d Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Mon, 20 Jul 2020 17:03:21 -0400 Subject: [PATCH 03/10] add test --- test/vanilla/AcceptanceTests/test_xml.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/vanilla/AcceptanceTests/test_xml.py b/test/vanilla/AcceptanceTests/test_xml.py index 7d00911d3a6..51056a33e41 100644 --- a/test/vanilla/AcceptanceTests/test_xml.py +++ b/test/vanilla/AcceptanceTests/test_xml.py @@ -183,3 +183,8 @@ def test_models(self): else: from xmlservice.models._models import Error as ErrorPy2 assert Error == ErrorPy2 + + def test_xms_text(self, client): + xml_object = client.xml.get_xms_text() + assert xml_object.language == "english" + assert xml_object.content == "I am text" From 795f3dda213dc0b719289a27698168756e75d0d6 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Mon, 20 Jul 2020 17:09:49 -0400 Subject: [PATCH 04/10] update msrest dependency in vanilla requirements --- test/vanilla/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/vanilla/requirements.txt b/test/vanilla/requirements.txt index 79b92bc1773..8a169f38825 100644 --- a/test/vanilla/requirements.txt +++ b/test/vanilla/requirements.txt @@ -3,7 +3,7 @@ pytest pytest-cov pytest-asyncio==0.10.0;python_full_version>="3.5.2" async_generator;python_full_version>="3.5.2" -msrest>=0.6.12 +git+https://github.com/Azure/msrest-for-python@xml_text azure-core>=1.3.0 aiohttp;python_full_version>="3.5.2" -e ./Expected/AcceptanceTests/AdditionalProperties From 379fc653155e2c20de6c97c6de5a13c5507faed8 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Mon, 20 Jul 2020 17:11:36 -0400 Subject: [PATCH 05/10] update changelog --- ChangeLog.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ChangeLog.md b/ChangeLog.md index 64243819970..1771d5fde4e 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -4,6 +4,10 @@ Autorest Core version: 3.0.6287 Modelerfour version: 4.15.378 +**New Features** + +- Add support for `x-ms-text` XML extension #722 + **Bug Fixes** - Correctly have default behavior of csv for array query parameters when collection format is not specified in the swagger From a0e0a71859cca377272b6a51259e2b013fc7bc05 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Mon, 27 Jul 2020 14:39:42 -0400 Subject: [PATCH 06/10] update testserver dependency --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9dd513423b8..4d33fb31359 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ }, "devDependencies": { "@autorest/autorest": "^3.0.0", - "@microsoft.azure/autorest.testserver": "^2.10.53" + "@microsoft.azure/autorest.testserver": "^2.10.54" }, "files": [ "autorest/**/*.py", From 84e3350a4e98f18cad1cf35ed91aa675f2e33930 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Mon, 27 Jul 2020 14:40:23 -0400 Subject: [PATCH 07/10] update dependency on msrest to master branch --- test/vanilla/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/vanilla/requirements.txt b/test/vanilla/requirements.txt index 8a169f38825..d897bf6cea2 100644 --- a/test/vanilla/requirements.txt +++ b/test/vanilla/requirements.txt @@ -3,7 +3,7 @@ pytest pytest-cov pytest-asyncio==0.10.0;python_full_version>="3.5.2" async_generator;python_full_version>="3.5.2" -git+https://github.com/Azure/msrest-for-python@xml_text +git+https://github.com/Azure/msrest-for-python azure-core>=1.3.0 aiohttp;python_full_version>="3.5.2" -e ./Expected/AcceptanceTests/AdditionalProperties From 04f27515eadee2fe0fd3ade84443dc2664484dea Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Mon, 27 Jul 2020 14:53:17 -0400 Subject: [PATCH 08/10] regenerate --- .../operations_async/_duration_operations_async.py | 2 +- .../operations/_duration_operations.py | 2 +- .../aio/operations_async/_date_operations_async.py | 4 ++-- .../bodydate/operations/_date_operations.py | 4 ++-- .../operations_async/_datetime_operations_async.py | 14 +++++++------- .../operations/_datetime_operations.py | 14 +++++++------- .../_datetimerfc1123_operations_async.py | 4 ++-- .../operations/_datetimerfc1123_operations.py | 4 ++-- .../operations_async/_duration_operations_async.py | 2 +- .../operations/_duration_operations.py | 2 +- .../aio/operations_async/_int_operations_async.py | 10 +++++----- .../bodyinteger/operations/_int_operations.py | 10 +++++----- .../_auto_rest_validation_test_operations_async.py | 2 +- .../_auto_rest_validation_test_operations.py | 2 +- 14 files changed, 38 insertions(+), 38 deletions(-) diff --git a/test/azure/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/operations_async/_duration_operations_async.py b/test/azure/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/operations_async/_duration_operations_async.py index 7336aca4623..30581e29d8a 100644 --- a/test/azure/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/operations_async/_duration_operations_async.py +++ b/test/azure/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/operations_async/_duration_operations_async.py @@ -92,7 +92,7 @@ async def put_positive_duration( ) -> None: """Put a positive duration value. - :param duration_body: + :param duration_body: duration body. :type duration_body: ~datetime.timedelta :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) diff --git a/test/azure/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/operations/_duration_operations.py b/test/azure/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/operations/_duration_operations.py index 6d39dd5be2a..dc5f1137b72 100644 --- a/test/azure/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/operations/_duration_operations.py +++ b/test/azure/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/operations/_duration_operations.py @@ -98,7 +98,7 @@ def put_positive_duration( # type: (...) -> None """Put a positive duration value. - :param duration_body: + :param duration_body: duration body. :type duration_body: ~datetime.timedelta :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) diff --git a/test/vanilla/Expected/AcceptanceTests/BodyDate/bodydate/aio/operations_async/_date_operations_async.py b/test/vanilla/Expected/AcceptanceTests/BodyDate/bodydate/aio/operations_async/_date_operations_async.py index 92e6223d0ba..fc20b9a3dc2 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyDate/bodydate/aio/operations_async/_date_operations_async.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyDate/bodydate/aio/operations_async/_date_operations_async.py @@ -221,7 +221,7 @@ async def put_max_date( ) -> None: """Put max date value 9999-12-31. - :param date_body: + :param date_body: date body. :type date_body: ~datetime.date :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -312,7 +312,7 @@ async def put_min_date( ) -> None: """Put min date value 0000-01-01. - :param date_body: + :param date_body: date body. :type date_body: ~datetime.date :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) diff --git a/test/vanilla/Expected/AcceptanceTests/BodyDate/bodydate/operations/_date_operations.py b/test/vanilla/Expected/AcceptanceTests/BodyDate/bodydate/operations/_date_operations.py index 5d66a9c4400..4df122f6196 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyDate/bodydate/operations/_date_operations.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyDate/bodydate/operations/_date_operations.py @@ -230,7 +230,7 @@ def put_max_date( # type: (...) -> None """Put max date value 9999-12-31. - :param date_body: + :param date_body: date body. :type date_body: ~datetime.date :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -323,7 +323,7 @@ def put_min_date( # type: (...) -> None """Put min date value 0000-01-01. - :param date_body: + :param date_body: date body. :type date_body: ~datetime.date :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) diff --git a/test/vanilla/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/operations_async/_datetime_operations_async.py b/test/vanilla/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/operations_async/_datetime_operations_async.py index de8cc8d1f23..a073097b93f 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/operations_async/_datetime_operations_async.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyDateTime/bodydatetime/aio/operations_async/_datetime_operations_async.py @@ -221,7 +221,7 @@ async def put_utc_max_date_time( ) -> None: """Put max datetime value 9999-12-31T23:59:59.999Z. - :param datetime_body: + :param datetime_body: datetime body. :type datetime_body: ~datetime.datetime :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -272,7 +272,7 @@ async def put_utc_max_date_time7_digits( This is against the recommendation that asks for 3 digits, but allow to test what happens in that scenario. - :param datetime_body: + :param datetime_body: datetime body. :type datetime_body: ~datetime.datetime :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -452,7 +452,7 @@ async def put_local_positive_offset_max_date_time( ) -> None: """Put max datetime value with positive numoffset 9999-12-31t23:59:59.999+14:00. - :param datetime_body: + :param datetime_body: datetime body. :type datetime_body: ~datetime.datetime :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -586,7 +586,7 @@ async def put_local_negative_offset_max_date_time( ) -> None: """Put max datetime value with positive numoffset 9999-12-31t23:59:59.999-14:00. - :param datetime_body: + :param datetime_body: datetime body. :type datetime_body: ~datetime.datetime :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -720,7 +720,7 @@ async def put_utc_min_date_time( ) -> None: """Put min datetime value 0001-01-01T00:00:00Z. - :param datetime_body: + :param datetime_body: datetime body. :type datetime_body: ~datetime.datetime :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -811,7 +811,7 @@ async def put_local_positive_offset_min_date_time( ) -> None: """Put min datetime value 0001-01-01T00:00:00+14:00. - :param datetime_body: + :param datetime_body: datetime body. :type datetime_body: ~datetime.datetime :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -902,7 +902,7 @@ async def put_local_negative_offset_min_date_time( ) -> None: """Put min datetime value 0001-01-01T00:00:00-14:00. - :param datetime_body: + :param datetime_body: datetime body. :type datetime_body: ~datetime.datetime :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) diff --git a/test/vanilla/Expected/AcceptanceTests/BodyDateTime/bodydatetime/operations/_datetime_operations.py b/test/vanilla/Expected/AcceptanceTests/BodyDateTime/bodydatetime/operations/_datetime_operations.py index f473d1b25a9..a453956c5ad 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyDateTime/bodydatetime/operations/_datetime_operations.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyDateTime/bodydatetime/operations/_datetime_operations.py @@ -230,7 +230,7 @@ def put_utc_max_date_time( # type: (...) -> None """Put max datetime value 9999-12-31T23:59:59.999Z. - :param datetime_body: + :param datetime_body: datetime body. :type datetime_body: ~datetime.datetime :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -282,7 +282,7 @@ def put_utc_max_date_time7_digits( This is against the recommendation that asks for 3 digits, but allow to test what happens in that scenario. - :param datetime_body: + :param datetime_body: datetime body. :type datetime_body: ~datetime.datetime :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -466,7 +466,7 @@ def put_local_positive_offset_max_date_time( # type: (...) -> None """Put max datetime value with positive numoffset 9999-12-31t23:59:59.999+14:00. - :param datetime_body: + :param datetime_body: datetime body. :type datetime_body: ~datetime.datetime :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -603,7 +603,7 @@ def put_local_negative_offset_max_date_time( # type: (...) -> None """Put max datetime value with positive numoffset 9999-12-31t23:59:59.999-14:00. - :param datetime_body: + :param datetime_body: datetime body. :type datetime_body: ~datetime.datetime :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -740,7 +740,7 @@ def put_utc_min_date_time( # type: (...) -> None """Put min datetime value 0001-01-01T00:00:00Z. - :param datetime_body: + :param datetime_body: datetime body. :type datetime_body: ~datetime.datetime :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -833,7 +833,7 @@ def put_local_positive_offset_min_date_time( # type: (...) -> None """Put min datetime value 0001-01-01T00:00:00+14:00. - :param datetime_body: + :param datetime_body: datetime body. :type datetime_body: ~datetime.datetime :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -926,7 +926,7 @@ def put_local_negative_offset_min_date_time( # type: (...) -> None """Put min datetime value 0001-01-01T00:00:00-14:00. - :param datetime_body: + :param datetime_body: datetime body. :type datetime_body: ~datetime.datetime :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) diff --git a/test/vanilla/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/operations_async/_datetimerfc1123_operations_async.py b/test/vanilla/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/operations_async/_datetimerfc1123_operations_async.py index 7f0b6581ec8..48da2e497bc 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/operations_async/_datetimerfc1123_operations_async.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/operations_async/_datetimerfc1123_operations_async.py @@ -221,7 +221,7 @@ async def put_utc_max_date_time( ) -> None: """Put max datetime value Fri, 31 Dec 9999 23:59:59 GMT. - :param datetime_body: + :param datetime_body: datetime body. :type datetime_body: ~datetime.datetime :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -355,7 +355,7 @@ async def put_utc_min_date_time( ) -> None: """Put min datetime value Mon, 1 Jan 0001 00:00:00 GMT. - :param datetime_body: + :param datetime_body: datetime body. :type datetime_body: ~datetime.datetime :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) diff --git a/test/vanilla/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/operations/_datetimerfc1123_operations.py b/test/vanilla/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/operations/_datetimerfc1123_operations.py index e40bb88dac8..e9ebfa217e7 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/operations/_datetimerfc1123_operations.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/operations/_datetimerfc1123_operations.py @@ -230,7 +230,7 @@ def put_utc_max_date_time( # type: (...) -> None """Put max datetime value Fri, 31 Dec 9999 23:59:59 GMT. - :param datetime_body: + :param datetime_body: datetime body. :type datetime_body: ~datetime.datetime :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -367,7 +367,7 @@ def put_utc_min_date_time( # type: (...) -> None """Put min datetime value Mon, 1 Jan 0001 00:00:00 GMT. - :param datetime_body: + :param datetime_body: datetime body. :type datetime_body: ~datetime.datetime :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) diff --git a/test/vanilla/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/operations_async/_duration_operations_async.py b/test/vanilla/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/operations_async/_duration_operations_async.py index 7336aca4623..30581e29d8a 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/operations_async/_duration_operations_async.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/operations_async/_duration_operations_async.py @@ -92,7 +92,7 @@ async def put_positive_duration( ) -> None: """Put a positive duration value. - :param duration_body: + :param duration_body: duration body. :type duration_body: ~datetime.timedelta :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) diff --git a/test/vanilla/Expected/AcceptanceTests/BodyDuration/bodyduration/operations/_duration_operations.py b/test/vanilla/Expected/AcceptanceTests/BodyDuration/bodyduration/operations/_duration_operations.py index 6d39dd5be2a..dc5f1137b72 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyDuration/bodyduration/operations/_duration_operations.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyDuration/bodyduration/operations/_duration_operations.py @@ -98,7 +98,7 @@ def put_positive_duration( # type: (...) -> None """Put a positive duration value. - :param duration_body: + :param duration_body: duration body. :type duration_body: ~datetime.timedelta :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) diff --git a/test/vanilla/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/operations_async/_int_operations_async.py b/test/vanilla/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/operations_async/_int_operations_async.py index f89d239a92e..f69fd8af31c 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/operations_async/_int_operations_async.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyInteger/bodyinteger/aio/operations_async/_int_operations_async.py @@ -307,7 +307,7 @@ async def put_max32( ) -> None: """Put max int32 value. - :param int_body: + :param int_body: int body. :type int_body: int :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -355,7 +355,7 @@ async def put_max64( ) -> None: """Put max int64 value. - :param int_body: + :param int_body: int body. :type int_body: long :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -403,7 +403,7 @@ async def put_min32( ) -> None: """Put min int32 value. - :param int_body: + :param int_body: int body. :type int_body: int :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -451,7 +451,7 @@ async def put_min64( ) -> None: """Put min int64 value. - :param int_body: + :param int_body: int body. :type int_body: long :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -542,7 +542,7 @@ async def put_unix_time_date( ) -> None: """Put datetime encoded as Unix time. - :param int_body: + :param int_body: int body. :type int_body: ~datetime.datetime :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) diff --git a/test/vanilla/Expected/AcceptanceTests/BodyInteger/bodyinteger/operations/_int_operations.py b/test/vanilla/Expected/AcceptanceTests/BodyInteger/bodyinteger/operations/_int_operations.py index 9bbaff76246..c6439399d39 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyInteger/bodyinteger/operations/_int_operations.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyInteger/bodyinteger/operations/_int_operations.py @@ -318,7 +318,7 @@ def put_max32( # type: (...) -> None """Put max int32 value. - :param int_body: + :param int_body: int body. :type int_body: int :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -367,7 +367,7 @@ def put_max64( # type: (...) -> None """Put max int64 value. - :param int_body: + :param int_body: int body. :type int_body: long :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -416,7 +416,7 @@ def put_min32( # type: (...) -> None """Put min int32 value. - :param int_body: + :param int_body: int body. :type int_body: int :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -465,7 +465,7 @@ def put_min64( # type: (...) -> None """Put min int64 value. - :param int_body: + :param int_body: int body. :type int_body: long :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -558,7 +558,7 @@ def put_unix_time_date( # type: (...) -> None """Put datetime encoded as Unix time. - :param int_body: + :param int_body: int body. :type int_body: ~datetime.datetime :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) diff --git a/test/vanilla/Expected/AcceptanceTests/Validation/validation/aio/operations_async/_auto_rest_validation_test_operations_async.py b/test/vanilla/Expected/AcceptanceTests/Validation/validation/aio/operations_async/_auto_rest_validation_test_operations_async.py index 3cb23964368..cd292ddefb0 100644 --- a/test/vanilla/Expected/AcceptanceTests/Validation/validation/aio/operations_async/_auto_rest_validation_test_operations_async.py +++ b/test/vanilla/Expected/AcceptanceTests/Validation/validation/aio/operations_async/_auto_rest_validation_test_operations_async.py @@ -47,7 +47,7 @@ async def validation_of_method_parameters( url = self.validation_of_method_parameters.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=10, min_length=3, pattern=r'[a-zA-Z0-9]+'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=10, min_length=3, pattern=r'[a-zA-Z0-9']+'), 'id': self._serialize.url("id", id, 'int', maximum=1000, minimum=100, multiple=10), } url = self._client.format_url(url, **path_format_arguments) diff --git a/test/vanilla/Expected/AcceptanceTests/Validation/validation/operations/_auto_rest_validation_test_operations.py b/test/vanilla/Expected/AcceptanceTests/Validation/validation/operations/_auto_rest_validation_test_operations.py index cd5d314195d..784f55cec78 100644 --- a/test/vanilla/Expected/AcceptanceTests/Validation/validation/operations/_auto_rest_validation_test_operations.py +++ b/test/vanilla/Expected/AcceptanceTests/Validation/validation/operations/_auto_rest_validation_test_operations.py @@ -52,7 +52,7 @@ def validation_of_method_parameters( url = self.validation_of_method_parameters.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=10, min_length=3, pattern=r'[a-zA-Z0-9]+'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=10, min_length=3, pattern=r'[a-zA-Z0-9']+'), 'id': self._serialize.url("id", id, 'int', maximum=1000, minimum=100, multiple=10), } url = self._client.format_url(url, **path_format_arguments) From 9838e7e0a1b0cc544cc73f060e10259f53c373eb Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Tue, 28 Jul 2020 11:20:23 -0400 Subject: [PATCH 09/10] udpate msrest dependency --- test/vanilla/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/vanilla/requirements.txt b/test/vanilla/requirements.txt index d897bf6cea2..383bc1f68ae 100644 --- a/test/vanilla/requirements.txt +++ b/test/vanilla/requirements.txt @@ -3,7 +3,7 @@ pytest pytest-cov pytest-asyncio==0.10.0;python_full_version>="3.5.2" async_generator;python_full_version>="3.5.2" -git+https://github.com/Azure/msrest-for-python +msrest>=0.6.18 azure-core>=1.3.0 aiohttp;python_full_version>="3.5.2" -e ./Expected/AcceptanceTests/AdditionalProperties From a5d28a9757fd912c9dc181e5f67209e98fe6178e Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Tue, 28 Jul 2020 11:32:08 -0400 Subject: [PATCH 10/10] add async xml test --- test/vanilla/AcceptanceTests/asynctests/test_xml.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/vanilla/AcceptanceTests/asynctests/test_xml.py b/test/vanilla/AcceptanceTests/asynctests/test_xml.py index 83e59a92f23..a289fe5a350 100644 --- a/test/vanilla/AcceptanceTests/asynctests/test_xml.py +++ b/test/vanilla/AcceptanceTests/asynctests/test_xml.py @@ -189,3 +189,9 @@ async def test_acls(self, client): assert len(acls) == 1 assert acls[0].id == 'MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI=' await _assert_with_log(client.xml.put_acls, acls) + + @pytest.mark.asyncio + async def test_xms_text(self, client): + xml_object = await client.xml.get_xms_text() + assert xml_object.language == "english" + assert xml_object.content == "I am text"