diff --git a/sdk/servicebus/azure-servicebus/CHANGELOG.md b/sdk/servicebus/azure-servicebus/CHANGELOG.md index 86d892779eed..77e523c803eb 100644 --- a/sdk/servicebus/azure-servicebus/CHANGELOG.md +++ b/sdk/servicebus/azure-servicebus/CHANGELOG.md @@ -1,6 +1,14 @@ # Release History -## 7.0.2 (Unreleased) +## 7.1.0 (Unreleased) + +**New Features** + +* Updated the following methods so that lists and single instances of dict representations are accepted for corresponding strongly-typed object arguments (PR #14807, thanks @bradleydamato): + - `update_queue`, `update_topic`, `update_subscription`, and `update_rule` on `ServiceBusAdministrationClient` accept dict representations of `QueueProperties`, `TopicProperties`, `SubscriptionProperties`, and `RuleProperties`, respectively. + - `send_messages` and `schedule_messages` on both sync and async versions of `ServiceBusSender` accept a list of or single instance of dict representations of `ServiceBusMessage`. + - `add_message` on `ServiceBusMessageBatch` now accepts a dict representation of `ServiceBusMessage`. + - Note: This is ongoing work and is the first step in supporting the above as respresentation of type `typing.Mapping`. **BugFixes** diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/_common/message.py b/sdk/servicebus/azure-servicebus/azure/servicebus/_common/message.py index 8b41a9495157..a9de43b03a26 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/_common/message.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/_common/message.py @@ -36,13 +36,14 @@ MESSAGE_PROPERTY_MAX_LENGTH, ) +from ..exceptions import MessageSizeExceededError from .utils import ( utc_from_timestamp, utc_now, transform_messages_to_sendable_if_needed, trace_message, + create_messages_from_dicts_if_needed ) -from ..exceptions import MessageSizeExceededError if TYPE_CHECKING: from ..aio._servicebus_receiver_async import ( @@ -537,7 +538,7 @@ def __len__(self): def _from_list(self, messages, parent_span=None): # type: (Iterable[ServiceBusMessage], AbstractSpan) -> None for each in messages: - if not isinstance(each, ServiceBusMessage): + if not isinstance(each, (ServiceBusMessage, dict)): raise TypeError( "Only ServiceBusMessage or an iterable object containing ServiceBusMessage " "objects are accepted. Received instead: {}".format( @@ -577,11 +578,14 @@ def add_message(self, message): :rtype: None :raises: :class: ~azure.servicebus.exceptions.MessageSizeExceededError, when exceeding the size limit. """ + return self._add(message) def _add(self, message, parent_span=None): # type: (ServiceBusMessage, AbstractSpan) -> None """Actual add implementation. The shim exists to hide the internal parameters such as parent_span.""" + + message = create_messages_from_dicts_if_needed(message, ServiceBusMessage) # type: ignore message = transform_messages_to_sendable_if_needed(message) trace_message( message, parent_span diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/_common/utils.py b/sdk/servicebus/azure-servicebus/azure/servicebus/_common/utils.py index e1d66616c14b..7c895aa43dcb 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/_common/utils.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/_common/utils.py @@ -9,7 +9,18 @@ import logging import functools import platform -from typing import Optional, Dict, Tuple, Iterable, Type, TYPE_CHECKING, Union, Iterator +from typing import ( + Any, + Dict, + Iterable, + Iterator, + List, + Mapping, + Optional, + Type, + TYPE_CHECKING, + Union +) from contextlib import contextmanager from msrest.serialization import UTC @@ -43,11 +54,26 @@ ) if TYPE_CHECKING: - from .message import ServiceBusReceivedMessage, ServiceBusMessage + from .message import ServiceBusReceivedMessage, ServiceBusMessage, ServiceBusMessageBatch from azure.core.tracing import AbstractSpan from .receiver_mixins import ReceiverMixin from .._servicebus_session import BaseSession + # pylint: disable=unused-import, ungrouped-imports + DictMessageType = Union[ + Mapping, + ServiceBusMessage, + List[Mapping[str, Any]], + List[ServiceBusMessage], + ServiceBusMessageBatch + ] + + DictMessageReturnType = Union[ + ServiceBusMessage, + List[ServiceBusMessage], + ServiceBusMessageBatch + ] + _log = logging.getLogger(__name__) @@ -196,6 +222,20 @@ def transform_messages_to_sendable_if_needed(messages): except AttributeError: return messages +def create_messages_from_dicts_if_needed(messages, message_type): + # type: (DictMessageType, type) -> DictMessageReturnType + """ + This method is used to convert dict representations + of messages to a list of ServiceBusMessage objects or ServiceBusBatchMessage. + :param DictMessageType messages: A list or single instance of messages of type ServiceBusMessages or + dict representations of type ServiceBusMessage. Also accepts ServiceBusBatchMessage. + :rtype: DictMessageReturnType + """ + if isinstance(messages, list): + return [(message_type(**message) if isinstance(message, dict) else message) for message in messages] + + return_messages = message_type(**messages) if isinstance(messages, dict) else messages + return return_messages def strip_protocol_from_uri(uri): # type: (str) -> str diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/_servicebus_sender.py b/sdk/servicebus/azure-servicebus/azure/servicebus/_servicebus_sender.py index bc946dcc82c4..fee2b3d4ed91 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/_servicebus_sender.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/_servicebus_sender.py @@ -21,6 +21,7 @@ from ._common.utils import ( create_authentication, transform_messages_to_sendable_if_needed, + create_messages_from_dicts_if_needed, send_trace_context_manager, trace_message, add_link_to_send, @@ -269,7 +270,9 @@ def schedule_messages(self, messages, schedule_time_utc, **kwargs): :caption: Schedule a message to be sent in future """ # pylint: disable=protected-access + self._check_live() + messages = create_messages_from_dicts_if_needed(messages, ServiceBusMessage) # type: ignore timeout = kwargs.pop("timeout", None) if timeout is not None and timeout <= 0: raise ValueError("The timeout must be greater than 0.") @@ -365,7 +368,9 @@ def send_messages(self, message, **kwargs): :caption: Send message. """ + self._check_live() + message = create_messages_from_dicts_if_needed(message, ServiceBusMessage) timeout = kwargs.pop("timeout", None) if timeout is not None and timeout <= 0: raise ValueError("The timeout must be greater than 0.") @@ -393,11 +398,9 @@ def send_messages(self, message, **kwargs): isinstance(message, ServiceBusMessageBatch) and len(message) == 0 ): # pylint: disable=len-as-condition return # Short circuit noop if an empty list or batch is provided. - if not isinstance(message, ServiceBusMessageBatch) and not isinstance( - message, ServiceBusMessage - ): + if not isinstance(message, (ServiceBusMessageBatch, ServiceBusMessage)): raise TypeError( - "Can only send azure.servicebus. " + "Can only send azure.servicebus. " "or lists of ServiceBusMessage." ) diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/_version.py b/sdk/servicebus/azure-servicebus/azure/servicebus/_version.py index bd682c54ddca..8037c72d55a4 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/_version.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/_version.py @@ -3,4 +3,4 @@ # Licensed under the MIT License. # ------------------------------------ -VERSION = "7.0.2" +VERSION = "7.1.0" diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/aio/_servicebus_sender_async.py b/sdk/servicebus/azure-servicebus/azure/servicebus/aio/_servicebus_sender_async.py index 97eb3c88a2e2..1e71b1255557 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/aio/_servicebus_sender_async.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/aio/_servicebus_sender_async.py @@ -22,6 +22,7 @@ from .._common import mgmt_handlers from .._common.utils import ( transform_messages_to_sendable_if_needed, + create_messages_from_dicts_if_needed, send_trace_context_manager, trace_message, add_link_to_send, @@ -206,7 +207,9 @@ async def schedule_messages( :caption: Schedule a message to be sent in future """ # pylint: disable=protected-access + self._check_live() + messages = create_messages_from_dicts_if_needed(messages, ServiceBusMessage) # type: ignore timeout = kwargs.pop("timeout", None) if timeout is not None and timeout <= 0: raise ValueError("The timeout must be greater than 0.") @@ -307,7 +310,9 @@ async def send_messages( :caption: Send message. """ + self._check_live() + message = create_messages_from_dicts_if_needed(message, ServiceBusMessage) timeout = kwargs.pop("timeout", None) if timeout is not None and timeout <= 0: raise ValueError("The timeout must be greater than 0.") @@ -333,9 +338,7 @@ async def send_messages( isinstance(message, ServiceBusMessageBatch) and len(message) == 0 ): # pylint: disable=len-as-condition return # Short circuit noop if an empty list or batch is provided. - if not isinstance(message, ServiceBusMessageBatch) and not isinstance( - message, ServiceBusMessage - ): + if not isinstance(message, (ServiceBusMessageBatch, ServiceBusMessage)): raise TypeError( "Can only send azure.servicebus. " "or lists of ServiceBusMessage." diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/aio/management/_management_client_async.py b/sdk/servicebus/azure-servicebus/azure/servicebus/aio/management/_management_client_async.py index f82386b198df..8f774c947846 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/aio/management/_management_client_async.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/aio/management/_management_client_async.py @@ -77,6 +77,7 @@ from ...management._utils import ( deserialize_rule_key_values, serialize_rule_key_values, + create_properties_from_dict_if_needed, _validate_entity_name_type, _validate_topic_and_subscription_types, _validate_topic_subscription_and_rule_types, @@ -411,7 +412,9 @@ async def update_queue(self, queue: QueueProperties, **kwargs) -> None: :rtype: None """ + queue = create_properties_from_dict_if_needed(queue, QueueProperties) # type: ignore to_update = queue._to_internal_entity() + to_update.default_message_time_to_live = avoid_timedelta_overflow( to_update.default_message_time_to_live ) @@ -636,6 +639,7 @@ async def update_topic(self, topic: TopicProperties, **kwargs) -> None: :rtype: None """ + topic = create_properties_from_dict_if_needed(topic, TopicProperties) # type: ignore to_update = topic._to_internal_entity() to_update.default_message_time_to_live = avoid_timedelta_overflow( @@ -880,8 +884,10 @@ async def update_subscription( from `get_subscription`, `update_subscription` or `list_subscription` and has the updated properties. :rtype: None """ + _validate_entity_name_type(topic_name, display_name="topic_name") + subscription = create_properties_from_dict_if_needed(subscription, SubscriptionProperties) # type: ignore to_update = subscription._to_internal_entity() to_update.default_message_time_to_live = avoid_timedelta_overflow( @@ -1079,6 +1085,7 @@ async def update_rule( """ _validate_topic_and_subscription_types(topic_name, subscription_name) + rule = create_properties_from_dict_if_needed(rule, RuleProperties) # type: ignore to_update = rule._to_internal_entity() create_entity_body = CreateRuleBody( diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/aio/management/_utils.py b/sdk/servicebus/azure-servicebus/azure/servicebus/aio/management/_utils.py index ef9875647eb3..0660b05a3a05 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/aio/management/_utils.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/aio/management/_utils.py @@ -8,7 +8,7 @@ import urllib.parse as urlparse -from azure.servicebus.management import _constants as constants +from ...management import _constants as constants from ...management._handle_response_error import _handle_response_error # This module defines functions get_next_template and extract_data_template. diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_management_client.py b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_management_client.py index f18f250bd7c0..eb4500c6916c 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_management_client.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_management_client.py @@ -46,6 +46,7 @@ deserialize_rule_key_values, serialize_rule_key_values, extract_rule_data_template, + create_properties_from_dict_if_needed, _validate_entity_name_type, _validate_topic_and_subscription_types, _validate_topic_subscription_and_rule_types, @@ -404,6 +405,7 @@ def update_queue(self, queue, **kwargs): :rtype: None """ + queue = create_properties_from_dict_if_needed(queue, QueueProperties) # type: ignore to_update = queue._to_internal_entity() to_update.default_message_time_to_live = avoid_timedelta_overflow( @@ -632,6 +634,7 @@ def update_topic(self, topic, **kwargs): :rtype: None """ + topic = create_properties_from_dict_if_needed(topic, TopicProperties) # type: ignore to_update = topic._to_internal_entity() to_update.default_message_time_to_live = ( @@ -884,8 +887,10 @@ def update_subscription(self, topic_name, subscription, **kwargs): from `get_subscription`, `update_subscription` or `list_subscription` and has the updated properties. :rtype: None """ + _validate_entity_name_type(topic_name, display_name="topic_name") + subscription = create_properties_from_dict_if_needed(subscription, SubscriptionProperties) # type: ignore to_update = subscription._to_internal_entity() to_update.default_message_time_to_live = avoid_timedelta_overflow( @@ -1077,6 +1082,7 @@ def update_rule(self, topic_name, subscription_name, rule, **kwargs): """ _validate_topic_and_subscription_types(topic_name, subscription_name) + rule = create_properties_from_dict_if_needed(rule, RuleProperties) # type: ignore to_update = rule._to_internal_entity() create_entity_body = CreateRuleBody( diff --git a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py index 3b676221ce2f..4d106036104f 100644 --- a/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py +++ b/sdk/servicebus/azure-servicebus/azure/servicebus/management/_utils.py @@ -3,11 +3,32 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- from datetime import datetime, timedelta -from typing import cast +from typing import TYPE_CHECKING, cast, Union, Mapping from xml.etree.ElementTree import ElementTree, SubElement, QName import isodate import six +from . import _constants as constants +from ._handle_response_error import _handle_response_error +if TYPE_CHECKING: + # pylint: disable=unused-import, ungrouped-imports + from ._models import QueueProperties, TopicProperties, \ + SubscriptionProperties, RuleProperties, InternalQueueDescription, InternalTopicDescription, \ + InternalSubscriptionDescription, InternalRuleDescription + DictPropertiesType = Union[ + QueueProperties, + TopicProperties, + SubscriptionProperties, + RuleProperties, + Mapping + ] + DictPropertiesReturnType = Union[ + QueueProperties, + TopicProperties, + SubscriptionProperties, + RuleProperties + ] + # Refer to the async version of this module under ..\aio\management\_utils.py for detailed explanation. try: @@ -15,10 +36,6 @@ except ImportError: import urlparse # type: ignore # for python 2.7 -from azure.servicebus.management import _constants as constants -from ._handle_response_error import _handle_response_error - - def extract_rule_data_template(feed_class, convert, feed_element): """Special version of function extrat_data_template for Rule. @@ -307,3 +324,16 @@ def _validate_topic_subscription_and_rule_types( type(topic_name), type(subscription_name), type(rule_name) ) ) + +def create_properties_from_dict_if_needed(properties, sb_resource_type): + # type: (DictPropertiesType, type) -> DictPropertiesReturnType + """ + This method is used to create a properties object given the + resource properties type and its corresponding dict representation. + :param properties: A properties object or its dict representation. + :type properties: DictPropertiesType + :param type sb_resource_type: The type of properties object. + :rtype: DictPropertiesReturnType + """ + return_properties = sb_resource_type(**properties) if isinstance(properties, dict) else properties + return return_properties diff --git a/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/recordings/test_mgmt_queues_async.test_mgmt_queue_async_update_dict_error.yaml b/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/recordings/test_mgmt_queues_async.test_mgmt_queue_async_update_dict_error.yaml new file mode 100644 index 000000000000..cee1cc582b3b --- /dev/null +++ b/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/recordings/test_mgmt_queues_async.test_mgmt_queue_async_update_dict_error.yaml @@ -0,0 +1,79 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://servicebustestsbname.servicebus.windows.net/$Resources/queues?$skip=0&$top=100&api-version=2017-04 + response: + body: + string: Queueshttps://servicebustestddyod7uodu.servicebus.windows.net/$Resources/queues?$skip=0&$top=100&api-version=2017-042021-03-02T19:55:45Z + headers: + content-type: application/atom+xml;type=feed;charset=utf-8 + date: Tue, 02 Mar 2021 19:55:45 GMT + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 200 + message: OK + url: https://servicebustestddyod7uodu.servicebus.windows.net/$Resources/queues?$skip=0&$top=100&api-version=2017-04 +- request: + body: ' + + ' + headers: + Accept: + - application/xml + Content-Length: + - '248' + Content-Type: + - application/atom+xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjruid?api-version=2017-04 + response: + body: + string: https://servicebustestddyod7uodu.servicebus.windows.net/fjruid?api-version=2017-04fjruid2021-03-02T19:55:46Z2021-03-02T19:55:46Zservicebustestddyod7uoduPT1M1024falsefalseP10675199DT2H48M5.4775807SfalsePT10M10true00falseActive2021-03-02T19:55:46.453Z2021-03-02T19:55:46.497ZtrueP10675199DT2H48M5.4775807SfalseAvailablefalse + headers: + content-type: application/atom+xml;type=entry;charset=utf-8 + date: Tue, 02 Mar 2021 19:55:46 GMT + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + transfer-encoding: chunked + status: + code: 201 + message: Created + url: https://servicebustestddyod7uodu.servicebus.windows.net/fjruid?api-version=2017-04 +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: DELETE + uri: https://servicebustestsbname.servicebus.windows.net/fjruid?api-version=2017-04 + response: + body: + string: '' + headers: + content-length: '0' + date: Tue, 02 Mar 2021 19:55:47 GMT + etag: '637503117464970000' + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + status: + code: 200 + message: OK + url: https://servicebustestddyod7uodu.servicebus.windows.net/fjruid?api-version=2017-04 +version: 1 diff --git a/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/recordings/test_mgmt_queues_async.test_mgmt_queue_async_update_dict_success.yaml b/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/recordings/test_mgmt_queues_async.test_mgmt_queue_async_update_dict_success.yaml new file mode 100644 index 000000000000..8488d0b4f249 --- /dev/null +++ b/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/recordings/test_mgmt_queues_async.test_mgmt_queue_async_update_dict_success.yaml @@ -0,0 +1,213 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://servicebustestsbname.servicebus.windows.net/$Resources/queues?$skip=0&$top=100&api-version=2017-04 + response: + body: + string: Queueshttps://servicebustestddyod7uodu.servicebus.windows.net/$Resources/queues?$skip=0&$top=100&api-version=2017-042021-03-02T19:55:48Z + headers: + content-type: application/atom+xml;type=feed;charset=utf-8 + date: Tue, 02 Mar 2021 19:55:48 GMT + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 200 + message: OK + url: https://servicebustestddyod7uodu.servicebus.windows.net/$Resources/queues?$skip=0&$top=100&api-version=2017-04 +- request: + body: ' + + ' + headers: + Accept: + - application/xml + Content-Length: + - '248' + Content-Type: + - application/atom+xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjruid?api-version=2017-04 + response: + body: + string: https://servicebustestddyod7uodu.servicebus.windows.net/fjruid?api-version=2017-04fjruid2021-03-02T19:55:48Z2021-03-02T19:55:49Zservicebustestddyod7uoduPT1M1024falsefalseP10675199DT2H48M5.4775807SfalsePT10M10true00falseActive2021-03-02T19:55:48.803Z2021-03-02T19:55:49.33ZtrueP10675199DT2H48M5.4775807SfalseAvailablefalse + headers: + content-type: application/atom+xml;type=entry;charset=utf-8 + date: Tue, 02 Mar 2021 19:55:49 GMT + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + transfer-encoding: chunked + status: + code: 201 + message: Created + url: https://servicebustestddyod7uodu.servicebus.windows.net/fjruid?api-version=2017-04 +- request: + body: ' + + PT2M1024falsefalseP10675199DT2H48M5.477539SfalsePT10M10trueActiveP10675199DT2H48M5.477539SfalseAvailablefalse' + headers: + Accept: + - application/xml + Content-Length: + - '1022' + Content-Type: + - application/atom+xml + If-Match: + - '*' + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjruid?api-version=2017-04 + response: + body: + string: https://servicebustestddyod7uodu.servicebus.windows.net/fjruid?api-version=2017-04fjruid2021-03-02T19:55:49Zservicebustestddyod7uoduPT2M1024falsefalseP10675199DT2H48M5.477539SfalsePT10M10trueActiveP10675199DT2H48M5.477539SfalseAvailablefalse + headers: + content-type: application/atom+xml;type=entry;charset=utf-8 + date: Tue, 02 Mar 2021 19:55:49 GMT + etag: '637503117493300000' + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + transfer-encoding: chunked + status: + code: 200 + message: OK + url: https://servicebustestddyod7uodu.servicebus.windows.net/fjruid?api-version=2017-04 +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://servicebustestsbname.servicebus.windows.net/fjruid?enrich=false&api-version=2017-04 + response: + body: + string: https://servicebustestddyod7uodu.servicebus.windows.net/fjruid?enrich=false&api-version=2017-04fjruid2021-03-02T19:55:48Z2021-03-02T19:55:49Zservicebustestddyod7uoduPT2M1024falsefalseP10675199DT2H48M5.477539SfalsePT10M10true00falseActive2021-03-02T19:55:48.803Z2021-03-02T19:55:49.843Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.477539SfalseAvailablefalse + headers: + content-type: application/atom+xml;type=entry;charset=utf-8 + date: Tue, 02 Mar 2021 19:55:49 GMT + etag: '637503117498430000' + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + transfer-encoding: chunked + status: + code: 200 + message: OK + url: https://servicebustestddyod7uodu.servicebus.windows.net/fjruid?enrich=false&api-version=2017-04 +- request: + body: ' + + PT13S3072falsefalsePT11MtruePT12M14trueActivePT10MfalseAvailabletruesb://servicebustestddyod7uodu.servicebus.windows.net/fjruidsb://servicebustestddyod7uodu.servicebus.windows.net/fjruid' + headers: + Accept: + - application/xml + Content-Length: + - '1185' + Content-Type: + - application/atom+xml + If-Match: + - '*' + ServiceBusDlqSupplementaryAuthorization: + - SharedAccessSignature sr=sb%3A%2F%2Fservicebustestddyod7uodu.servicebus.windows.net%2Ffjruid&sig=VaMpXW3G4F5i%2fJFgNczWAV%2fWF7XLhqCH7H0NDK2F2bQ%3d&se=1614718549&skn=RootManageSharedAccessKey + ServiceBusSupplementaryAuthorization: + - SharedAccessSignature sr=sb%3A%2F%2Fservicebustestddyod7uodu.servicebus.windows.net%2Ffjruid&sig=VaMpXW3G4F5i%2fJFgNczWAV%2fWF7XLhqCH7H0NDK2F2bQ%3d&se=1614718549&skn=RootManageSharedAccessKey + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjruid?api-version=2017-04 + response: + body: + string: https://servicebustestddyod7uodu.servicebus.windows.net/fjruid?api-version=2017-04fjruid2021-03-02T19:55:50Zservicebustestddyod7uoduPT13S3072falsefalsePT11MtruePT12M14trueActivePT10MfalseAvailabletruesb://servicebustestddyod7uodu.servicebus.windows.net/fjruidsb://servicebustestddyod7uodu.servicebus.windows.net/fjruid + headers: + content-type: application/atom+xml;type=entry;charset=utf-8 + date: Tue, 02 Mar 2021 19:55:50 GMT + etag: '637503117498430000' + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + transfer-encoding: chunked + status: + code: 200 + message: OK + url: https://servicebustestddyod7uodu.servicebus.windows.net/fjruid?api-version=2017-04 +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://servicebustestsbname.servicebus.windows.net/fjruid?enrich=false&api-version=2017-04 + response: + body: + string: https://servicebustestddyod7uodu.servicebus.windows.net/fjruid?enrich=false&api-version=2017-04fjruid2021-03-02T19:55:48Z2021-03-02T19:55:50Zservicebustestddyod7uoduPT13S3072falsefalsePT11MtruePT12M14true00falseActive2021-03-02T19:55:48.803Z2021-03-02T19:55:50.09Z0001-01-01T00:00:00Ztrue00000PT10MfalseAvailabletruesb://servicebustestddyod7uodu.servicebus.windows.net/fjruidsb://servicebustestddyod7uodu.servicebus.windows.net/fjruid + headers: + content-type: application/atom+xml;type=entry;charset=utf-8 + date: Tue, 02 Mar 2021 19:55:50 GMT + etag: '637503117500900000' + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + transfer-encoding: chunked + status: + code: 200 + message: OK + url: https://servicebustestddyod7uodu.servicebus.windows.net/fjruid?enrich=false&api-version=2017-04 +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: DELETE + uri: https://servicebustestsbname.servicebus.windows.net/fjruid?api-version=2017-04 + response: + body: + string: '' + headers: + content-length: '0' + date: Tue, 02 Mar 2021 19:55:50 GMT + etag: '637503117500900000' + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + status: + code: 200 + message: OK + url: https://servicebustestddyod7uodu.servicebus.windows.net/fjruid?api-version=2017-04 +version: 1 diff --git a/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/recordings/test_mgmt_rules_async.test_mgmt_rule_async_update_dict_error.yaml b/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/recordings/test_mgmt_rules_async.test_mgmt_rule_async_update_dict_error.yaml new file mode 100644 index 000000000000..39562de3b06c --- /dev/null +++ b/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/recordings/test_mgmt_rules_async.test_mgmt_rule_async_update_dict_error.yaml @@ -0,0 +1,195 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://servicebustestsbname.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-04 + response: + body: + string: Topicshttps://servicebustest7unr4yo2aa.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-042021-03-02T19:55:12Z + headers: + content-type: application/atom+xml;type=feed;charset=utf-8 + date: Tue, 02 Mar 2021 19:55:12 GMT + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 200 + message: OK + url: https://servicebustest7unr4yo2aa.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-04 +- request: + body: ' + + ' + headers: + Accept: + - application/xml + Content-Length: + - '248' + Content-Type: + - application/atom+xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjrui?api-version=2017-04 + response: + body: + string: https://servicebustest7unr4yo2aa.servicebus.windows.net/fjrui?api-version=2017-04fjrui2021-03-02T19:55:13Z2021-03-02T19:55:13Zservicebustest7unr4yo2aaP10675199DT2H48M5.4775807S1024falsePT10Mtrue0falsefalseActive2021-03-02T19:55:13.237Z2021-03-02T19:55:13.32ZtrueP10675199DT2H48M5.4775807SfalseAvailablefalsefalse + headers: + content-type: application/atom+xml;type=entry;charset=utf-8 + date: Tue, 02 Mar 2021 19:55:13 GMT + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + transfer-encoding: chunked + status: + code: 201 + message: Created + url: https://servicebustest7unr4yo2aa.servicebus.windows.net/fjrui?api-version=2017-04 +- request: + body: ' + + ' + headers: + Accept: + - application/xml + Content-Length: + - '255' + Content-Type: + - application/atom+xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjrui/subscriptions/eqkovc?api-version=2017-04 + response: + body: + string: https://servicebustest7unr4yo2aa.servicebus.windows.net/fjrui/subscriptions/eqkovc?api-version=2017-04eqkovc2021-03-02T19:55:13Z2021-03-02T19:55:13ZPT1MfalseP10675199DT2H48M5.4775807Sfalsetrue010trueActive2021-03-02T19:55:13.9089858Z2021-03-02T19:55:13.9089858Z0001-01-01T00:00:00P10675199DT2H48M5.4775807SAvailable + headers: + content-type: application/atom+xml;type=entry;charset=utf-8 + date: Tue, 02 Mar 2021 19:55:13 GMT + etag: '637503117133200000' + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + transfer-encoding: chunked + status: + code: 201 + message: Created + url: https://servicebustest7unr4yo2aa.servicebus.windows.net/fjrui/subscriptions/eqkovc?api-version=2017-04 +- request: + body: ' + + Priority = ''low''20truerule' + headers: + Accept: + - application/xml + Content-Length: + - '550' + Content-Type: + - application/atom+xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjrui/subscriptions/eqkovc/rules/rule?api-version=2017-04 + response: + body: + string: https://servicebustest7unr4yo2aa.servicebus.windows.net/fjrui/subscriptions/eqkovc/rules/rule?api-version=2017-04rule2021-03-02T19:55:14Z2021-03-02T19:55:14ZPriority + = 'low'20true2021-03-02T19:55:14.1589554Zrule + headers: + content-type: application/atom+xml;type=entry;charset=utf-8 + date: Tue, 02 Mar 2021 19:55:14 GMT + etag: '637503117133200000' + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + transfer-encoding: chunked + status: + code: 201 + message: Created + url: https://servicebustest7unr4yo2aa.servicebus.windows.net/fjrui/subscriptions/eqkovc/rules/rule?api-version=2017-04 +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: DELETE + uri: https://servicebustestsbname.servicebus.windows.net/fjrui/subscriptions/eqkovc/rules/rule?api-version=2017-04 + response: + body: + string: '' + headers: + content-length: '0' + date: Tue, 02 Mar 2021 19:55:14 GMT + etag: '637503117133200000' + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + status: + code: 200 + message: OK + url: https://servicebustest7unr4yo2aa.servicebus.windows.net/fjrui/subscriptions/eqkovc/rules/rule?api-version=2017-04 +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: DELETE + uri: https://servicebustestsbname.servicebus.windows.net/fjrui/subscriptions/eqkovc?api-version=2017-04 + response: + body: + string: '' + headers: + content-length: '0' + date: Tue, 02 Mar 2021 19:55:14 GMT + etag: '637503117133200000' + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + status: + code: 200 + message: OK + url: https://servicebustest7unr4yo2aa.servicebus.windows.net/fjrui/subscriptions/eqkovc?api-version=2017-04 +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: DELETE + uri: https://servicebustestsbname.servicebus.windows.net/fjrui?api-version=2017-04 + response: + body: + string: '' + headers: + content-length: '0' + date: Tue, 02 Mar 2021 19:55:14 GMT + etag: '637503117133200000' + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + status: + code: 200 + message: OK + url: https://servicebustest7unr4yo2aa.servicebus.windows.net/fjrui?api-version=2017-04 +version: 1 diff --git a/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/recordings/test_mgmt_rules_async.test_mgmt_rule_async_update_dict_success.yaml b/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/recordings/test_mgmt_rules_async.test_mgmt_rule_async_update_dict_success.yaml new file mode 100644 index 000000000000..c2f0aa0bcfaf --- /dev/null +++ b/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/recordings/test_mgmt_rules_async.test_mgmt_rule_async_update_dict_success.yaml @@ -0,0 +1,291 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://servicebustestsbname.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-04 + response: + body: + string: Topicshttps://servicebustest7unr4yo2aa.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-042021-03-02T19:55:15Z + headers: + content-type: application/atom+xml;type=feed;charset=utf-8 + date: Tue, 02 Mar 2021 19:55:15 GMT + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 200 + message: OK + url: https://servicebustest7unr4yo2aa.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-04 +- request: + body: ' + + ' + headers: + Accept: + - application/xml + Content-Length: + - '248' + Content-Type: + - application/atom+xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjruid?api-version=2017-04 + response: + body: + string: https://servicebustest7unr4yo2aa.servicebus.windows.net/fjruid?api-version=2017-04fjruid2021-03-02T19:55:16Z2021-03-02T19:55:16Zservicebustest7unr4yo2aaP10675199DT2H48M5.4775807S1024falsePT10Mtrue0falsefalseActive2021-03-02T19:55:16.153Z2021-03-02T19:55:16.19ZtrueP10675199DT2H48M5.4775807SfalseAvailablefalsefalse + headers: + content-type: application/atom+xml;type=entry;charset=utf-8 + date: Tue, 02 Mar 2021 19:55:16 GMT + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + transfer-encoding: chunked + status: + code: 201 + message: Created + url: https://servicebustest7unr4yo2aa.servicebus.windows.net/fjruid?api-version=2017-04 +- request: + body: ' + + ' + headers: + Accept: + - application/xml + Content-Length: + - '255' + Content-Type: + - application/atom+xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjruid/subscriptions/eqkovcd?api-version=2017-04 + response: + body: + string: https://servicebustest7unr4yo2aa.servicebus.windows.net/fjruid/subscriptions/eqkovcd?api-version=2017-04eqkovcd2021-03-02T19:55:16Z2021-03-02T19:55:16ZPT1MfalseP10675199DT2H48M5.4775807Sfalsetrue010trueActive2021-03-02T19:55:16.8002409Z2021-03-02T19:55:16.8002409Z0001-01-01T00:00:00P10675199DT2H48M5.4775807SAvailable + headers: + content-type: application/atom+xml;type=entry;charset=utf-8 + date: Tue, 02 Mar 2021 19:55:16 GMT + etag: '637503117161900000' + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + transfer-encoding: chunked + status: + code: 201 + message: Created + url: https://servicebustest7unr4yo2aa.servicebus.windows.net/fjruid/subscriptions/eqkovcd?api-version=2017-04 +- request: + body: ' + + Priority = ''low''20truerule' + headers: + Accept: + - application/xml + Content-Length: + - '550' + Content-Type: + - application/atom+xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjruid/subscriptions/eqkovcd/rules/rule?api-version=2017-04 + response: + body: + string: https://servicebustest7unr4yo2aa.servicebus.windows.net/fjruid/subscriptions/eqkovcd/rules/rule?api-version=2017-04rule2021-03-02T19:55:17Z2021-03-02T19:55:17ZPriority + = 'low'20true2021-03-02T19:55:17.0346264Zrule + headers: + content-type: application/atom+xml;type=entry;charset=utf-8 + date: Tue, 02 Mar 2021 19:55:16 GMT + etag: '637503117161900000' + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + transfer-encoding: chunked + status: + code: 201 + message: Created + url: https://servicebustest7unr4yo2aa.servicebus.windows.net/fjruid/subscriptions/eqkovcd/rules/rule?api-version=2017-04 +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://servicebustestsbname.servicebus.windows.net/fjruid/subscriptions/eqkovcd/rules/rule?enrich=false&api-version=2017-04 + response: + body: + string: sb://servicebustest7unr4yo2aa.servicebus.windows.net/fjruid/subscriptions/eqkovcd/rules/rule?enrich=false&api-version=2017-04rule2021-03-02T19:55:17Z2021-03-02T19:55:17ZPriority + = 'low'20true2021-03-02T19:55:17.0480329Zrule + headers: + content-type: application/atom+xml;type=entry;charset=utf-8 + date: Tue, 02 Mar 2021 19:55:16 GMT + etag: '637503117161900000' + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + transfer-encoding: chunked + status: + code: 200 + message: OK + url: https://servicebustest7unr4yo2aa.servicebus.windows.net/fjruid/subscriptions/eqkovcd/rules/rule?enrich=false&api-version=2017-04 +- request: + body: ' + + testcidSET Priority = ''low''20true2021-03-02T19:55:17.048032Zrule' + headers: + Accept: + - application/xml + Content-Length: + - '655' + Content-Type: + - application/atom+xml + If-Match: + - '*' + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjruid/subscriptions/eqkovcd/rules/rule?api-version=2017-04 + response: + body: + string: https://servicebustest7unr4yo2aa.servicebus.windows.net/fjruid/subscriptions/eqkovcd/rules/rule?api-version=2017-04rule2021-03-02T19:55:17Z2021-03-02T19:55:17ZtestcidSET Priority = 'low'20true2021-03-02T19:55:17.3471465Zrule + headers: + content-type: application/atom+xml;type=entry;charset=utf-8 + date: Tue, 02 Mar 2021 19:55:16 GMT + etag: '637503117161900000' + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + transfer-encoding: chunked + status: + code: 200 + message: OK + url: https://servicebustest7unr4yo2aa.servicebus.windows.net/fjruid/subscriptions/eqkovcd/rules/rule?api-version=2017-04 +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://servicebustestsbname.servicebus.windows.net/fjruid/subscriptions/eqkovcd/rules/rule?enrich=false&api-version=2017-04 + response: + body: + string: sb://servicebustest7unr4yo2aa.servicebus.windows.net/fjruid/subscriptions/eqkovcd/rules/rule?enrich=false&api-version=2017-04rule2021-03-02T19:55:17Z2021-03-02T19:55:17ZtestcidSET Priority = 'low'20true2021-03-02T19:55:17.0480329Zrule + headers: + content-type: application/atom+xml;type=entry;charset=utf-8 + date: Tue, 02 Mar 2021 19:55:16 GMT + etag: '637503117161900000' + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + transfer-encoding: chunked + status: + code: 200 + message: OK + url: https://servicebustest7unr4yo2aa.servicebus.windows.net/fjruid/subscriptions/eqkovcd/rules/rule?enrich=false&api-version=2017-04 +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: DELETE + uri: https://servicebustestsbname.servicebus.windows.net/fjruid/subscriptions/eqkovcd/rules/rule?api-version=2017-04 + response: + body: + string: '' + headers: + content-length: '0' + date: Tue, 02 Mar 2021 19:55:17 GMT + etag: '637503117161900000' + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + status: + code: 200 + message: OK + url: https://servicebustest7unr4yo2aa.servicebus.windows.net/fjruid/subscriptions/eqkovcd/rules/rule?api-version=2017-04 +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: DELETE + uri: https://servicebustestsbname.servicebus.windows.net/fjruid/subscriptions/eqkovcd?api-version=2017-04 + response: + body: + string: '' + headers: + content-length: '0' + date: Tue, 02 Mar 2021 19:55:17 GMT + etag: '637503117161900000' + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + status: + code: 200 + message: OK + url: https://servicebustest7unr4yo2aa.servicebus.windows.net/fjruid/subscriptions/eqkovcd?api-version=2017-04 +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: DELETE + uri: https://servicebustestsbname.servicebus.windows.net/fjruid?api-version=2017-04 + response: + body: + string: '' + headers: + content-length: '0' + date: Tue, 02 Mar 2021 19:55:17 GMT + etag: '637503117161900000' + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + status: + code: 200 + message: OK + url: https://servicebustest7unr4yo2aa.servicebus.windows.net/fjruid?api-version=2017-04 +version: 1 diff --git a/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/recordings/test_mgmt_subscriptions_async.test_mgmt_subscription_async_update_dict_error.yaml b/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/recordings/test_mgmt_subscriptions_async.test_mgmt_subscription_async_update_dict_error.yaml new file mode 100644 index 000000000000..b6c32532ecb2 --- /dev/null +++ b/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/recordings/test_mgmt_subscriptions_async.test_mgmt_subscription_async_update_dict_error.yaml @@ -0,0 +1,135 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://servicebustestsbname.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-04 + response: + body: + string: Topicshttps://servicebustestqwlgxkbg2s.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-042021-03-02T19:55:39Z + headers: + content-type: application/atom+xml;type=feed;charset=utf-8 + date: Tue, 02 Mar 2021 19:55:39 GMT + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 200 + message: OK + url: https://servicebustestqwlgxkbg2s.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-04 +- request: + body: ' + + ' + headers: + Accept: + - application/xml + Content-Length: + - '248' + Content-Type: + - application/atom+xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjrui?api-version=2017-04 + response: + body: + string: https://servicebustestqwlgxkbg2s.servicebus.windows.net/fjrui?api-version=2017-04fjrui2021-03-02T19:55:40Z2021-03-02T19:55:40Zservicebustestqwlgxkbg2sP10675199DT2H48M5.4775807S1024falsePT10Mtrue0falsefalseActive2021-03-02T19:55:40.3Z2021-03-02T19:55:40.337ZtrueP10675199DT2H48M5.4775807SfalseAvailablefalsefalse + headers: + content-type: application/atom+xml;type=entry;charset=utf-8 + date: Tue, 02 Mar 2021 19:55:40 GMT + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + transfer-encoding: chunked + status: + code: 201 + message: Created + url: https://servicebustestqwlgxkbg2s.servicebus.windows.net/fjrui?api-version=2017-04 +- request: + body: ' + + ' + headers: + Accept: + - application/xml + Content-Length: + - '255' + Content-Type: + - application/atom+xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjrui/subscriptions/eqkovc?api-version=2017-04 + response: + body: + string: https://servicebustestqwlgxkbg2s.servicebus.windows.net/fjrui/subscriptions/eqkovc?api-version=2017-04eqkovc2021-03-02T19:55:40Z2021-03-02T19:55:40ZPT1MfalseP10675199DT2H48M5.4775807Sfalsetrue010trueActive2021-03-02T19:55:40.837581Z2021-03-02T19:55:40.837581Z0001-01-01T00:00:00P10675199DT2H48M5.4775807SAvailable + headers: + content-type: application/atom+xml;type=entry;charset=utf-8 + date: Tue, 02 Mar 2021 19:55:40 GMT + etag: '637503117403370000' + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + transfer-encoding: chunked + status: + code: 201 + message: Created + url: https://servicebustestqwlgxkbg2s.servicebus.windows.net/fjrui/subscriptions/eqkovc?api-version=2017-04 +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: DELETE + uri: https://servicebustestsbname.servicebus.windows.net/fjrui/subscriptions/eqkovc?api-version=2017-04 + response: + body: + string: '' + headers: + content-length: '0' + date: Tue, 02 Mar 2021 19:55:40 GMT + etag: '637503117403370000' + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + status: + code: 200 + message: OK + url: https://servicebustestqwlgxkbg2s.servicebus.windows.net/fjrui/subscriptions/eqkovc?api-version=2017-04 +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: DELETE + uri: https://servicebustestsbname.servicebus.windows.net/fjrui?api-version=2017-04 + response: + body: + string: '' + headers: + content-length: '0' + date: Tue, 02 Mar 2021 19:55:40 GMT + etag: '637503117403370000' + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + status: + code: 200 + message: OK + url: https://servicebustestqwlgxkbg2s.servicebus.windows.net/fjrui?api-version=2017-04 +version: 1 diff --git a/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/recordings/test_mgmt_subscriptions_async.test_mgmt_subscription_async_update_dict_success.yaml b/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/recordings/test_mgmt_subscriptions_async.test_mgmt_subscription_async_update_dict_success.yaml new file mode 100644 index 000000000000..fef0bdcd822a --- /dev/null +++ b/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/recordings/test_mgmt_subscriptions_async.test_mgmt_subscription_async_update_dict_success.yaml @@ -0,0 +1,331 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://servicebustestsbname.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-04 + response: + body: + string: Topicshttps://servicebustestqwlgxkbg2s.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-042021-03-02T19:55:42Z + headers: + content-type: application/atom+xml;type=feed;charset=utf-8 + date: Tue, 02 Mar 2021 19:55:41 GMT + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 200 + message: OK + url: https://servicebustestqwlgxkbg2s.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-04 +- request: + body: ' + + ' + headers: + Accept: + - application/xml + Content-Length: + - '248' + Content-Type: + - application/atom+xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjrui?api-version=2017-04 + response: + body: + string: https://servicebustestqwlgxkbg2s.servicebus.windows.net/fjrui?api-version=2017-04fjrui2021-03-02T19:55:42Z2021-03-02T19:55:42Zservicebustestqwlgxkbg2sP10675199DT2H48M5.4775807S1024falsePT10Mtrue0falsefalseActive2021-03-02T19:55:42.577Z2021-03-02T19:55:42.64ZtrueP10675199DT2H48M5.4775807SfalseAvailablefalsefalse + headers: + content-type: application/atom+xml;type=entry;charset=utf-8 + date: Tue, 02 Mar 2021 19:55:42 GMT + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + transfer-encoding: chunked + status: + code: 201 + message: Created + url: https://servicebustestqwlgxkbg2s.servicebus.windows.net/fjrui?api-version=2017-04 +- request: + body: ' + + ' + headers: + Accept: + - application/xml + Content-Length: + - '255' + Content-Type: + - application/atom+xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjrui/subscriptions/eqkovc?api-version=2017-04 + response: + body: + string: https://servicebustestqwlgxkbg2s.servicebus.windows.net/fjrui/subscriptions/eqkovc?api-version=2017-04eqkovc2021-03-02T19:55:43Z2021-03-02T19:55:43ZPT1MfalseP10675199DT2H48M5.4775807Sfalsetrue010trueActive2021-03-02T19:55:43.2005268Z2021-03-02T19:55:43.2005268Z0001-01-01T00:00:00P10675199DT2H48M5.4775807SAvailable + headers: + content-type: application/atom+xml;type=entry;charset=utf-8 + date: Tue, 02 Mar 2021 19:55:43 GMT + etag: '637503117426400000' + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + transfer-encoding: chunked + status: + code: 201 + message: Created + url: https://servicebustestqwlgxkbg2s.servicebus.windows.net/fjrui/subscriptions/eqkovc?api-version=2017-04 +- request: + body: ' + + PT2MfalseP10675199DT2H48M5.477539Sfalsetrue10trueActiveP10675199DT2H48M5.477539SAvailable' + headers: + Accept: + - application/xml + Content-Length: + - '836' + Content-Type: + - application/atom+xml + If-Match: + - '*' + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjrui/subscriptions/eqkovc?api-version=2017-04 + response: + body: + string: https://servicebustestqwlgxkbg2s.servicebus.windows.net/fjrui/subscriptions/eqkovc?api-version=2017-04eqkovc2021-03-02T19:55:43Z2021-03-02T19:55:43ZPT2MfalseP10675199DT2H48M5.477539Sfalsetrue010trueActive2021-03-02T19:55:43.4974034Z2021-03-02T19:55:43.4974034Z0001-01-01T00:00:00P10675199DT2H48M5.477539SAvailable + headers: + content-type: application/atom+xml;type=entry;charset=utf-8 + date: Tue, 02 Mar 2021 19:55:43 GMT + etag: '637503117426400000' + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + transfer-encoding: chunked + status: + code: 200 + message: OK + url: https://servicebustestqwlgxkbg2s.servicebus.windows.net/fjrui/subscriptions/eqkovc?api-version=2017-04 +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://servicebustestsbname.servicebus.windows.net/fjrui/subscriptions/eqkovc?enrich=false&api-version=2017-04 + response: + body: + string: sb://servicebustestqwlgxkbg2s.servicebus.windows.net/fjrui/subscriptions/eqkovc?enrich=false&api-version=2017-04eqkovc2021-03-02T19:55:43Z2021-03-02T19:55:43ZPT2MfalseP10675199DT2H48M5.477539Sfalsetrue010trueActive2021-03-02T19:55:43.2038102Z2021-03-02T19:55:43.5016686Z2021-03-02T19:55:43.2038102Z00000P10675199DT2H48M5.477539SAvailable + headers: + content-type: application/atom+xml;type=entry;charset=utf-8 + date: Tue, 02 Mar 2021 19:55:43 GMT + etag: '637503117426400000' + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + transfer-encoding: chunked + status: + code: 200 + message: OK + url: https://servicebustestqwlgxkbg2s.servicebus.windows.net/fjrui/subscriptions/eqkovc?enrich=false&api-version=2017-04 +- request: + body: ' + + PT12SfalsePT11Mtruetrue14trueActivePT10MAvailable' + headers: + Accept: + - application/xml + Content-Length: + - '796' + Content-Type: + - application/atom+xml + If-Match: + - '*' + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjrui/subscriptions/eqkovc?api-version=2017-04 + response: + body: + string: https://servicebustestqwlgxkbg2s.servicebus.windows.net/fjrui/subscriptions/eqkovc?api-version=2017-04eqkovc2021-03-02T19:55:43Z2021-03-02T19:55:43ZPT12SfalsePT11Mtruetrue014trueActive2021-03-02T19:55:43.7161583Z2021-03-02T19:55:43.7161583Z0001-01-01T00:00:00PT10MAvailable + headers: + content-type: application/atom+xml;type=entry;charset=utf-8 + date: Tue, 02 Mar 2021 19:55:43 GMT + etag: '637503117426400000' + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + transfer-encoding: chunked + status: + code: 200 + message: OK + url: https://servicebustestqwlgxkbg2s.servicebus.windows.net/fjrui/subscriptions/eqkovc?api-version=2017-04 +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://servicebustestsbname.servicebus.windows.net/fjrui/subscriptions/eqkovc?enrich=false&api-version=2017-04 + response: + body: + string: sb://servicebustestqwlgxkbg2s.servicebus.windows.net/fjrui/subscriptions/eqkovc?enrich=false&api-version=2017-04eqkovc2021-03-02T19:55:43Z2021-03-02T19:55:43ZPT12SfalsePT11Mtruetrue014trueActive2021-03-02T19:55:43.2038102Z2021-03-02T19:55:43.7204468Z2021-03-02T19:55:43.2038102Z00000PT10MAvailable + headers: + content-type: application/atom+xml;type=entry;charset=utf-8 + date: Tue, 02 Mar 2021 19:55:43 GMT + etag: '637503117426400000' + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + transfer-encoding: chunked + status: + code: 200 + message: OK + url: https://servicebustestqwlgxkbg2s.servicebus.windows.net/fjrui/subscriptions/eqkovc?enrich=false&api-version=2017-04 +- request: + body: ' + + PT12SfalsePT11Mtruetrue14trueActivesb://servicebustestqwlgxkbg2s.servicebus.windows.net/fjruisb://servicebustestqwlgxkbg2s.servicebus.windows.net/fjruiPT10MAvailable' + headers: + Accept: + - application/xml + Content-Length: + - '998' + Content-Type: + - application/atom+xml + If-Match: + - '*' + ServiceBusDlqSupplementaryAuthorization: + - SharedAccessSignature sr=sb%3A%2F%2Fservicebustestqwlgxkbg2s.servicebus.windows.net%2Ffjrui&sig=9nOV37RbMacHrTSvL7wv6qLImc0w0M83TT0Efgv8XMQ%3d&se=1614718543&skn=RootManageSharedAccessKey + ServiceBusSupplementaryAuthorization: + - SharedAccessSignature sr=sb%3A%2F%2Fservicebustestqwlgxkbg2s.servicebus.windows.net%2Ffjrui&sig=9nOV37RbMacHrTSvL7wv6qLImc0w0M83TT0Efgv8XMQ%3d&se=1614718543&skn=RootManageSharedAccessKey + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjrui/subscriptions/eqkovc?api-version=2017-04 + response: + body: + string: https://servicebustestqwlgxkbg2s.servicebus.windows.net/fjrui/subscriptions/eqkovc?api-version=2017-04eqkovc2021-03-02T19:55:43Z2021-03-02T19:55:43ZPT12SfalsePT11Mtruetrue014trueActivesb://servicebustestqwlgxkbg2s.servicebus.windows.net/fjrui2021-03-02T19:55:43.9661578Z2021-03-02T19:55:43.9661578Z0001-01-01T00:00:00sb://servicebustestqwlgxkbg2s.servicebus.windows.net/fjruiP10675199DT2H48M5.4775807SAvailable + headers: + content-type: application/atom+xml;type=entry;charset=utf-8 + date: Tue, 02 Mar 2021 19:55:43 GMT + etag: '637503117426400000' + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + transfer-encoding: chunked + status: + code: 200 + message: OK + url: https://servicebustestqwlgxkbg2s.servicebus.windows.net/fjrui/subscriptions/eqkovc?api-version=2017-04 +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://servicebustestsbname.servicebus.windows.net/fjrui/subscriptions/eqkovc?enrich=false&api-version=2017-04 + response: + body: + string: sb://servicebustestqwlgxkbg2s.servicebus.windows.net/fjrui/subscriptions/eqkovc?enrich=false&api-version=2017-04eqkovc2021-03-02T19:55:43Z2021-03-02T19:55:43ZPT12SfalsePT11Mtruetrue014trueActivesb://servicebustestqwlgxkbg2s.servicebus.windows.net/fjrui2021-03-02T19:55:43.2038102Z2021-03-02T19:55:43.9703879Z2021-03-02T19:55:43.2038102Z00000sb://servicebustestqwlgxkbg2s.servicebus.windows.net/fjruiP10675199DT2H48M5.4775807SAvailable + headers: + content-type: application/atom+xml;type=entry;charset=utf-8 + date: Tue, 02 Mar 2021 19:55:43 GMT + etag: '637503117426400000' + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + transfer-encoding: chunked + status: + code: 200 + message: OK + url: https://servicebustestqwlgxkbg2s.servicebus.windows.net/fjrui/subscriptions/eqkovc?enrich=false&api-version=2017-04 +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: DELETE + uri: https://servicebustestsbname.servicebus.windows.net/fjrui/subscriptions/eqkovc?api-version=2017-04 + response: + body: + string: '' + headers: + content-length: '0' + date: Tue, 02 Mar 2021 19:55:43 GMT + etag: '637503117426400000' + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + status: + code: 200 + message: OK + url: https://servicebustestqwlgxkbg2s.servicebus.windows.net/fjrui/subscriptions/eqkovc?api-version=2017-04 +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: DELETE + uri: https://servicebustestsbname.servicebus.windows.net/fjrui?api-version=2017-04 + response: + body: + string: '' + headers: + content-length: '0' + date: Tue, 02 Mar 2021 19:55:44 GMT + etag: '637503117426400000' + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + status: + code: 200 + message: OK + url: https://servicebustestqwlgxkbg2s.servicebus.windows.net/fjrui?api-version=2017-04 +version: 1 diff --git a/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/recordings/test_mgmt_topics_async.test_mgmt_topic_async_update_dict_error.yaml b/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/recordings/test_mgmt_topics_async.test_mgmt_topic_async_update_dict_error.yaml new file mode 100644 index 000000000000..ccf6de93fa0a --- /dev/null +++ b/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/recordings/test_mgmt_topics_async.test_mgmt_topic_async_update_dict_error.yaml @@ -0,0 +1,79 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://servicebustestsbname.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-04 + response: + body: + string: Topicshttps://servicebustestqmzhmfhh7b.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-042021-03-02T19:57:09Z + headers: + content-type: application/atom+xml;type=feed;charset=utf-8 + date: Tue, 02 Mar 2021 19:57:09 GMT + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 200 + message: OK + url: https://servicebustestqmzhmfhh7b.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-04 +- request: + body: ' + + ' + headers: + Accept: + - application/xml + Content-Length: + - '248' + Content-Type: + - application/atom+xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjruid?api-version=2017-04 + response: + body: + string: https://servicebustestqmzhmfhh7b.servicebus.windows.net/fjruid?api-version=2017-04fjruid2021-03-02T19:57:09Z2021-03-02T19:57:09Zservicebustestqmzhmfhh7bP10675199DT2H48M5.4775807S1024falsePT10Mtrue0falsefalseActive2021-03-02T19:57:09.773Z2021-03-02T19:57:09.803ZtrueP10675199DT2H48M5.4775807SfalseAvailablefalsefalse + headers: + content-type: application/atom+xml;type=entry;charset=utf-8 + date: Tue, 02 Mar 2021 19:57:10 GMT + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + transfer-encoding: chunked + status: + code: 201 + message: Created + url: https://servicebustestqmzhmfhh7b.servicebus.windows.net/fjruid?api-version=2017-04 +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: DELETE + uri: https://servicebustestsbname.servicebus.windows.net/fjruid?api-version=2017-04 + response: + body: + string: '' + headers: + content-length: '0' + date: Tue, 02 Mar 2021 19:57:10 GMT + etag: '637503118298030000' + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + status: + code: 200 + message: OK + url: https://servicebustestqmzhmfhh7b.servicebus.windows.net/fjruid?api-version=2017-04 +version: 1 diff --git a/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/recordings/test_mgmt_topics_async.test_mgmt_topic_async_update_dict_success.yaml b/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/recordings/test_mgmt_topics_async.test_mgmt_topic_async_update_dict_success.yaml new file mode 100644 index 000000000000..5c9576640325 --- /dev/null +++ b/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/recordings/test_mgmt_topics_async.test_mgmt_topic_async_update_dict_success.yaml @@ -0,0 +1,209 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://servicebustestsbname.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-04 + response: + body: + string: Topicshttps://servicebustestqmzhmfhh7b.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-042021-03-02T19:57:11Z + headers: + content-type: application/atom+xml;type=feed;charset=utf-8 + date: Tue, 02 Mar 2021 19:57:11 GMT + server: Microsoft-HTTPAPI/2.0 + transfer-encoding: chunked + status: + code: 200 + message: OK + url: https://servicebustestqmzhmfhh7b.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-04 +- request: + body: ' + + ' + headers: + Accept: + - application/xml + Content-Length: + - '248' + Content-Type: + - application/atom+xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjruid?api-version=2017-04 + response: + body: + string: https://servicebustestqmzhmfhh7b.servicebus.windows.net/fjruid?api-version=2017-04fjruid2021-03-02T19:57:12Z2021-03-02T19:57:12Zservicebustestqmzhmfhh7bP10675199DT2H48M5.4775807S1024falsePT10Mtrue0falsefalseActive2021-03-02T19:57:12.083Z2021-03-02T19:57:12.17ZtrueP10675199DT2H48M5.4775807SfalseAvailablefalsefalse + headers: + content-type: application/atom+xml;type=entry;charset=utf-8 + date: Tue, 02 Mar 2021 19:57:12 GMT + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + transfer-encoding: chunked + status: + code: 201 + message: Created + url: https://servicebustestqmzhmfhh7b.servicebus.windows.net/fjruid?api-version=2017-04 +- request: + body: ' + + PT2M1024falsePT10Mtrue0ActivetrueP10675199DT2H48M5.477539SfalseAvailablefalse' + headers: + Accept: + - application/xml + Content-Length: + - '882' + Content-Type: + - application/atom+xml + If-Match: + - '*' + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjruid?api-version=2017-04 + response: + body: + string: https://servicebustestqmzhmfhh7b.servicebus.windows.net/fjruid?api-version=2017-04fjruid2021-03-02T19:57:12Zservicebustestqmzhmfhh7bPT2M1024falsePT10Mtrue0ActivetrueP10675199DT2H48M5.477539SfalseAvailablefalse + headers: + content-type: application/atom+xml;type=entry;charset=utf-8 + date: Tue, 02 Mar 2021 19:57:12 GMT + etag: '637503118321700000' + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + transfer-encoding: chunked + status: + code: 200 + message: OK + url: https://servicebustestqmzhmfhh7b.servicebus.windows.net/fjruid?api-version=2017-04 +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://servicebustestsbname.servicebus.windows.net/fjruid?enrich=false&api-version=2017-04 + response: + body: + string: https://servicebustestqmzhmfhh7b.servicebus.windows.net/fjruid?enrich=false&api-version=2017-04fjruid2021-03-02T19:57:12Z2021-03-02T19:57:12Zservicebustestqmzhmfhh7bPT2M1024falsePT10Mtrue0falsefalseActive2021-03-02T19:57:12.083Z2021-03-02T19:57:12.777Z0001-01-01T00:00:00Ztrue000000P10675199DT2H48M5.477539SfalseAvailablefalsefalse + headers: + content-type: application/atom+xml;type=entry;charset=utf-8 + date: Tue, 02 Mar 2021 19:57:12 GMT + etag: '637503118327770000' + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + transfer-encoding: chunked + status: + code: 200 + message: OK + url: https://servicebustestqmzhmfhh7b.servicebus.windows.net/fjruid?enrich=false&api-version=2017-04 +- request: + body: ' + + PT11M3072falsePT12Mtrue0ActivetruePT10MfalseAvailabletrue' + headers: + Accept: + - application/xml + Content-Length: + - '862' + Content-Type: + - application/atom+xml + If-Match: + - '*' + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjruid?api-version=2017-04 + response: + body: + string: https://servicebustestqmzhmfhh7b.servicebus.windows.net/fjruid?api-version=2017-04fjruid2021-03-02T19:57:13Zservicebustestqmzhmfhh7bPT11M3072falsePT12Mtrue0ActivetruePT10MfalseAvailabletrue + headers: + content-type: application/atom+xml;type=entry;charset=utf-8 + date: Tue, 02 Mar 2021 19:57:13 GMT + etag: '637503118327770000' + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + transfer-encoding: chunked + status: + code: 200 + message: OK + url: https://servicebustestqmzhmfhh7b.servicebus.windows.net/fjruid?api-version=2017-04 +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://servicebustestsbname.servicebus.windows.net/fjruid?enrich=false&api-version=2017-04 + response: + body: + string: https://servicebustestqmzhmfhh7b.servicebus.windows.net/fjruid?enrich=false&api-version=2017-04fjruid2021-03-02T19:57:12Z2021-03-02T19:57:13Zservicebustestqmzhmfhh7bPT11M3072falsePT12Mtrue0falsefalseActive2021-03-02T19:57:12.083Z2021-03-02T19:57:13.1Z0001-01-01T00:00:00Ztrue000000PT10MfalseAvailablefalsetrue + headers: + content-type: application/atom+xml;type=entry;charset=utf-8 + date: Tue, 02 Mar 2021 19:57:13 GMT + etag: '637503118331000000' + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + transfer-encoding: chunked + status: + code: 200 + message: OK + url: https://servicebustestqmzhmfhh7b.servicebus.windows.net/fjruid?enrich=false&api-version=2017-04 +- request: + body: null + headers: + Accept: + - application/xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: DELETE + uri: https://servicebustestsbname.servicebus.windows.net/fjruid?api-version=2017-04 + response: + body: + string: '' + headers: + content-length: '0' + date: Tue, 02 Mar 2021 19:57:13 GMT + etag: '637503118331000000' + server: Microsoft-HTTPAPI/2.0 + strict-transport-security: max-age=31536000 + status: + code: 200 + message: OK + url: https://servicebustestqmzhmfhh7b.servicebus.windows.net/fjruid?api-version=2017-04 +version: 1 diff --git a/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/test_mgmt_queues_async.py b/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/test_mgmt_queues_async.py index a796b0ebe032..6422dd046823 100644 --- a/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/test_mgmt_queues_async.py +++ b/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/test_mgmt_queues_async.py @@ -446,3 +446,73 @@ async def test_async_mgmt_queue_get_runtime_properties_negative(self, servicebus with pytest.raises(ResourceNotFoundError): await mgmt_service.get_queue_runtime_properties("non_existing_queue") + + @CachedResourceGroupPreparer(name_prefix='servicebustest') + @CachedServiceBusNamespacePreparer(name_prefix='servicebustest') + async def test_mgmt_queue_async_update_dict_success(self, servicebus_namespace_connection_string, servicebus_namespace, **kwargs): + mgmt_service = ServiceBusAdministrationClient.from_connection_string(servicebus_namespace_connection_string) + await clear_queues(mgmt_service) + queue_name = "fjruid" + queue_description = await mgmt_service.create_queue(queue_name) + queue_description_dict = dict(queue_description) + try: + # Try updating one setting. + queue_description_dict["lock_duration"] = datetime.timedelta(minutes=2) + await mgmt_service.update_queue(queue_description_dict) + + queue_description = await mgmt_service.get_queue(queue_name) + assert queue_description.lock_duration == datetime.timedelta(minutes=2) + + # Now try updating all settings. + queue_description_dict = dict(queue_description) + queue_description_dict["auto_delete_on_idle"] = datetime.timedelta(minutes=10) + queue_description_dict["dead_lettering_on_message_expiration"] = True + queue_description_dict["default_message_time_to_live"] = datetime.timedelta(minutes=11) + queue_description_dict["duplicate_detection_history_time_window"] = datetime.timedelta(minutes=12) + queue_description_dict["enable_batched_operations"] = True + queue_description_dict["enable_express"] = True + #queue_description_dict["enable_partitioning"] = True # Cannot be changed after creation + queue_description_dict["lock_duration"] = datetime.timedelta(seconds=13) + queue_description_dict["max_delivery_count"] = 14 + queue_description_dict["max_size_in_megabytes"] = 3072 + queue_description_dict["forward_to"] = "sb://{}.servicebus.windows.net/{}".format(servicebus_namespace.name, queue_name) + queue_description_dict["forward_dead_lettered_messages_to"] = "sb://{}.servicebus.windows.net/{}".format(servicebus_namespace.name, queue_name) + #queue_description_dict["requires_duplicate_detection"] = True # Read only + #queue_description_dict["requires_session"] = True # Cannot be changed after creation + + await mgmt_service.update_queue(queue_description_dict) + queue_description = await mgmt_service.get_queue(queue_name) + + assert queue_description.auto_delete_on_idle == datetime.timedelta(minutes=10) + assert queue_description.dead_lettering_on_message_expiration == True + assert queue_description.default_message_time_to_live == datetime.timedelta(minutes=11) + assert queue_description.duplicate_detection_history_time_window == datetime.timedelta(minutes=12) + assert queue_description.enable_batched_operations == True + assert queue_description.enable_express == True + #assert queue_description.enable_partitioning == True + assert queue_description.lock_duration == datetime.timedelta(seconds=13) + assert queue_description.max_delivery_count == 14 + assert queue_description.max_size_in_megabytes == 3072 + assert queue_description.forward_to.endswith(".servicebus.windows.net/{}".format(queue_name)) + # Note: We endswith to avoid the fact that the servicebus_namespace_name is replacered locally but not in the properties bag, and still test this. + assert queue_description.forward_dead_lettered_messages_to.endswith(".servicebus.windows.net/{}".format(queue_name)) + #assert queue_description.requires_duplicate_detection == True + #assert queue_description.requires_session == True + finally: + await mgmt_service.delete_queue(queue_name) + + @pytest.mark.liveTest + @CachedResourceGroupPreparer(name_prefix='servicebustest') + @CachedServiceBusNamespacePreparer(name_prefix='servicebustest') + async def test_mgmt_queue_async_update_dict_error(self, servicebus_namespace_connection_string, **kwargs): + mgmt_service = ServiceBusAdministrationClient.from_connection_string(servicebus_namespace_connection_string) + await clear_queues(mgmt_service) + queue_name = "fjruid" + queue_description = await mgmt_service.create_queue(queue_name) + try: + # send in queue dict without non-name keyword args + queue_description_only_name = {"name": queue_name} + with pytest.raises(TypeError): + await mgmt_service.update_queue(queue_description_only_name) + finally: + await mgmt_service.delete_queue(queue_name) diff --git a/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/test_mgmt_rules_async.py b/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/test_mgmt_rules_async.py index 6f8f7f7a72b0..5c57c152da4d 100644 --- a/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/test_mgmt_rules_async.py +++ b/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/test_mgmt_rules_async.py @@ -244,3 +244,66 @@ async def test_async_mgmt_rule_list_and_delete(self, servicebus_namespace_connec finally: await mgmt_service.delete_subscription(topic_name, subscription_name) await mgmt_service.delete_topic(topic_name) + + @CachedResourceGroupPreparer(name_prefix='servicebustest') + @CachedServiceBusNamespacePreparer(name_prefix='servicebustest') + async def test_mgmt_rule_async_update_dict_success(self, servicebus_namespace_connection_string, **kwargs): + mgmt_service = ServiceBusAdministrationClient.from_connection_string(servicebus_namespace_connection_string) + await clear_topics(mgmt_service) + topic_name = "fjruid" + subscription_name = "eqkovcd" + rule_name = 'rule' + sql_filter = SqlRuleFilter("Priority = 'low'") + + try: + topic_description = await mgmt_service.create_topic(topic_name) + subscription_description = await mgmt_service.create_subscription(topic_description.name, subscription_name) + await mgmt_service.create_rule(topic_name, subscription_name, rule_name, filter=sql_filter) + + rule_desc = await mgmt_service.get_rule(topic_name, subscription_name, rule_name) + + assert type(rule_desc.filter) == SqlRuleFilter + assert rule_desc.filter.sql_expression == "Priority = 'low'" + + correlation_fitler = CorrelationRuleFilter(correlation_id='testcid') + sql_rule_action = SqlRuleAction(sql_expression="SET Priority = 'low'") + + rule_desc.filter = correlation_fitler + rule_desc.action = sql_rule_action + rule_desc_dict = dict(rule_desc) + await mgmt_service.update_rule(topic_description.name, subscription_description.name, rule_desc_dict) + + rule_desc = await mgmt_service.get_rule(topic_name, subscription_name, rule_name) + assert type(rule_desc.filter) == CorrelationRuleFilter + assert rule_desc.filter.correlation_id == 'testcid' + assert rule_desc.action.sql_expression == "SET Priority = 'low'" + + finally: + await mgmt_service.delete_rule(topic_name, subscription_name, rule_name) + await mgmt_service.delete_subscription(topic_name, subscription_name) + await mgmt_service.delete_topic(topic_name) + + @CachedResourceGroupPreparer(name_prefix='servicebustest') + @CachedServiceBusNamespacePreparer(name_prefix='servicebustest') + async def test_mgmt_rule_async_update_dict_error(self, servicebus_namespace_connection_string, **kwargs): + mgmt_service = ServiceBusAdministrationClient.from_connection_string(servicebus_namespace_connection_string) + await clear_topics(mgmt_service) + topic_name = "fjrui" + subscription_name = "eqkovc" + rule_name = 'rule' + sql_filter = SqlRuleFilter("Priority = 'low'") + + try: + topic_description = await mgmt_service.create_topic(topic_name) + subscription_description = await mgmt_service.create_subscription(topic_description.name, subscription_name) + await mgmt_service.create_rule(topic_name, subscription_name, rule_name, filter=sql_filter) + + # send in rule dict without non-name keyword args + rule_description_only_name = {"name": topic_name} + with pytest.raises(TypeError): + await mgmt_service.update_rule(topic_description.name, subscription_description.name, rule_description_only_name) + + finally: + await mgmt_service.delete_rule(topic_name, subscription_name, rule_name) + await mgmt_service.delete_subscription(topic_name, subscription_name) + await mgmt_service.delete_topic(topic_name) \ No newline at end of file diff --git a/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/test_mgmt_subscriptions_async.py b/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/test_mgmt_subscriptions_async.py index 54c7dbb546b2..4fcafe344665 100644 --- a/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/test_mgmt_subscriptions_async.py +++ b/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/test_mgmt_subscriptions_async.py @@ -303,3 +303,76 @@ async def test_async_mgmt_subscription_get_runtime_properties_basic(self, servic await mgmt_service.delete_subscription(topic_name, subscription_name) await mgmt_service.delete_topic(topic_name) + + @CachedResourceGroupPreparer(name_prefix='servicebustest') + @CachedServiceBusNamespacePreparer(name_prefix='servicebustest') + async def test_mgmt_subscription_async_update_dict_success(self, servicebus_namespace_connection_string, servicebus_namespace, **kwargs): + mgmt_service = ServiceBusAdministrationClient.from_connection_string(servicebus_namespace_connection_string) + await clear_topics(mgmt_service) + topic_name = "fjrui" + subscription_name = "eqkovc" + + try: + topic_description = await mgmt_service.create_topic(topic_name) + subscription_description = await mgmt_service.create_subscription(topic_description.name, subscription_name) + subscription_description_dict = dict(subscription_description) + + # Try updating one setting. + subscription_description_dict["lock_duration"] = datetime.timedelta(minutes=2) + await mgmt_service.update_subscription(topic_description.name, subscription_description_dict) + subscription_description = await mgmt_service.get_subscription(topic_name, subscription_name) + assert subscription_description.lock_duration == datetime.timedelta(minutes=2) + + # Now try updating all settings. + subscription_description_dict = dict(subscription_description) + subscription_description_dict["auto_delete_on_idle"] = datetime.timedelta(minutes=10) + subscription_description_dict["dead_lettering_on_message_expiration"] = True + subscription_description_dict["default_message_time_to_live"] = datetime.timedelta(minutes=11) + subscription_description_dict["lock_duration"] = datetime.timedelta(seconds=12) + subscription_description_dict["max_delivery_count"] = 14 + # topic_description.enable_partitioning = True # Cannot be changed after creation + # topic_description.requires_session = True # Cannot be changed after creation + + await mgmt_service.update_subscription(topic_description.name, subscription_description_dict) + subscription_description = await mgmt_service.get_subscription(topic_description.name, subscription_name) + + assert subscription_description.auto_delete_on_idle == datetime.timedelta(minutes=10) + assert subscription_description.dead_lettering_on_message_expiration == True + assert subscription_description.default_message_time_to_live == datetime.timedelta(minutes=11) + assert subscription_description.max_delivery_count == 14 + assert subscription_description.lock_duration == datetime.timedelta(seconds=12) + # assert topic_description.enable_partitioning == True + # assert topic_description.requires_session == True + + # Finally, test forward_to (separately, as it changes auto_delete_on_idle when you enable it.) + subscription_description_dict = dict(subscription_description) + subscription_description_dict["forward_to"] = "sb://{}.servicebus.windows.net/{}".format(servicebus_namespace.name, topic_name) + subscription_description_dict["forward_dead_lettered_messages_to"] = "sb://{}.servicebus.windows.net/{}".format(servicebus_namespace.name, topic_name) + await mgmt_service.update_subscription(topic_description.name, subscription_description_dict) + subscription_description = await mgmt_service.get_subscription(topic_description.name, subscription_name) + # Note: We endswith to avoid the fact that the servicebus_namespace_name is replacered locally but not in the properties bag, and still test this. + assert subscription_description.forward_to.endswith(".servicebus.windows.net/{}".format(topic_name)) + assert subscription_description.forward_dead_lettered_messages_to.endswith(".servicebus.windows.net/{}".format(topic_name)) + + finally: + await mgmt_service.delete_subscription(topic_name, subscription_name) + await mgmt_service.delete_topic(topic_name) + + @CachedResourceGroupPreparer(name_prefix='servicebustest') + @CachedServiceBusNamespacePreparer(name_prefix='servicebustest') + async def test_mgmt_subscription_async_update_dict_error(self, servicebus_namespace_connection_string, **kwargs): + mgmt_service = ServiceBusAdministrationClient.from_connection_string(servicebus_namespace_connection_string) + await clear_topics(mgmt_service) + topic_name = "fjrui" + subscription_name = "eqkovc" + + try: + topic_description = await mgmt_service.create_topic(topic_name) + subscription_description = await mgmt_service.create_subscription(topic_description.name, subscription_name) + # send in subscription dict without non-name keyword args + subscription_description_only_name = {"name": topic_name} + with pytest.raises(TypeError): + await mgmt_service.update_subscription(topic_description.name, subscription_description_only_name) + finally: + await mgmt_service.delete_subscription(topic_name, subscription_name) + await mgmt_service.delete_topic(topic_name) diff --git a/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/test_mgmt_topics_async.py b/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/test_mgmt_topics_async.py index bc2991f798a7..b67b5df5dd5b 100644 --- a/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/test_mgmt_topics_async.py +++ b/sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/test_mgmt_topics_async.py @@ -256,3 +256,65 @@ async def test_async_mgmt_topic_get_runtime_properties_basic(self, servicebus_na assert topic_runtime_properties.scheduled_message_count == 0 finally: await mgmt_service.delete_topic("test_topic") + + @CachedResourceGroupPreparer(name_prefix='servicebustest') + @CachedServiceBusNamespacePreparer(name_prefix='servicebustest') + async def test_mgmt_topic_async_update_dict_success(self, servicebus_namespace_connection_string, **kwargs): + mgmt_service = ServiceBusAdministrationClient.from_connection_string(servicebus_namespace_connection_string) + await clear_topics(mgmt_service) + topic_name = "fjruid" + + try: + topic_description = await mgmt_service.create_topic(topic_name) + topic_description_dict = dict(topic_description) + + # Try updating one setting. + topic_description_dict["default_message_time_to_live"] = datetime.timedelta(minutes=2) + await mgmt_service.update_topic(topic_description_dict) + topic_description = await mgmt_service.get_topic(topic_name) + assert topic_description.default_message_time_to_live == datetime.timedelta(minutes=2) + + # Now try updating all settings. + topic_description_dict = dict(topic_description) + topic_description_dict["auto_delete_on_idle"] = datetime.timedelta(minutes=10) + topic_description_dict["default_message_time_to_live"] = datetime.timedelta(minutes=11) + topic_description_dict["duplicate_detection_history_time_window"] = datetime.timedelta(minutes=12) + topic_description_dict["enable_batched_operations"] = True + topic_description_dict["enable_express"] = True + # topic_description_dict["enable_partitioning"] = True # Cannot be changed after creation + topic_description_dict["max_size_in_megabytes"] = 3072 + # topic_description_dict["requires_duplicate_detection"] = True # Read only + # topic_description_dict["requires_session"] = True # Cannot be changed after creation + topic_description_dict["support_ordering"] = True + + await mgmt_service.update_topic(topic_description_dict) + topic_description = await mgmt_service.get_topic(topic_name) + + assert topic_description.auto_delete_on_idle == datetime.timedelta(minutes=10) + assert topic_description.default_message_time_to_live == datetime.timedelta(minutes=11) + assert topic_description.duplicate_detection_history_time_window == datetime.timedelta(minutes=12) + assert topic_description.enable_batched_operations == True + assert topic_description.enable_express == True + # assert topic_description.enable_partitioning == True + assert topic_description.max_size_in_megabytes == 3072 + # assert topic_description.requires_duplicate_detection == True + # assert topic_description.requires_session == True + assert topic_description.support_ordering == True + finally: + await mgmt_service.delete_topic(topic_name) + + @pytest.mark.liveTest + @CachedResourceGroupPreparer(name_prefix='servicebustest') + @CachedServiceBusNamespacePreparer(name_prefix='servicebustest') + async def test_mgmt_topic_async_update_dict_error(self, servicebus_namespace_connection_string, **kwargs): + mgmt_service = ServiceBusAdministrationClient.from_connection_string(servicebus_namespace_connection_string) + await clear_topics(mgmt_service) + topic_name = "fjruid" + try: + topic_description = await mgmt_service.create_topic(topic_name) + # send in topic dict without non-name keyword args + topic_description_only_name = {"name": topic_name} + with pytest.raises(TypeError): + await mgmt_service.update_topic(topic_description_only_name) + finally: + await mgmt_service.delete_topic(topic_name) diff --git a/sdk/servicebus/azure-servicebus/tests/async_tests/test_queues_async.py b/sdk/servicebus/azure-servicebus/tests/async_tests/test_queues_async.py index 36545e7ede80..bab61acd00a7 100644 --- a/sdk/servicebus/azure-servicebus/tests/async_tests/test_queues_async.py +++ b/sdk/servicebus/azure-servicebus/tests/async_tests/test_queues_async.py @@ -1722,7 +1722,7 @@ async def test_async_send_message_no_body(self, servicebus_namespace_connection_ message = await receiver.__anext__() assert message.body is None await receiver.complete_message(message) - + @pytest.mark.liveTest @pytest.mark.live_test_only @CachedResourceGroupPreparer(name_prefix='servicebustest') @@ -1750,4 +1750,149 @@ async def test_async_queue_by_servicebus_client_enum_case_sensitivity(self, serv async with sb_client.get_queue_receiver(servicebus_queue.name, sub_queue=str.upper(ServiceBusSubQueue.DEAD_LETTER.value), max_wait_time=5) as receiver: - raise Exception("Should not get here, should be case sensitive.") \ No newline at end of file + raise Exception("Should not get here, should be case sensitive.") + + @pytest.mark.liveTest + @pytest.mark.live_test_only + @CachedResourceGroupPreparer(name_prefix='servicebustest') + @CachedServiceBusNamespacePreparer(name_prefix='servicebustest') + @ServiceBusQueuePreparer(name_prefix='servicebustest') + async def test_queue_async_send_dict_messages(self, servicebus_namespace_connection_string, servicebus_queue, **kwargs): + async with ServiceBusClient.from_connection_string( + servicebus_namespace_connection_string, logging_enable=False) as sb_client: + + async with sb_client.get_queue_sender(servicebus_queue.name) as sender: + + message_dict = {"body": "Message"} + message2_dict = {"body": "Message2"} + list_message_dicts = [message_dict, message2_dict] + + # send single dict + await sender.send_messages(message_dict) + + # send list of dicts + await sender.send_messages(list_message_dicts) + + # create and send BatchMessage with dicts + batch_message = await sender.create_message_batch() + batch_message._from_list(list_message_dicts) # pylint: disable=protected-access + batch_message.add_message(message_dict) + await sender.send_messages(batch_message) + + received_messages = [] + async with sb_client.get_queue_receiver(servicebus_queue.name, max_wait_time=5) as receiver: + async for message in receiver: + received_messages.append(message) + assert len(received_messages) == 6 + + @pytest.mark.liveTest + @pytest.mark.live_test_only + @CachedResourceGroupPreparer(name_prefix='servicebustest') + @CachedServiceBusNamespacePreparer(name_prefix='servicebustest') + @ServiceBusQueuePreparer(name_prefix='servicebustest') + async def test_queue_async_send_dict_messages_error_badly_formatted_dicts(self, servicebus_namespace_connection_string, servicebus_queue, **kwargs): + async with ServiceBusClient.from_connection_string( + servicebus_namespace_connection_string, logging_enable=False) as sb_client: + + async with sb_client.get_queue_sender(servicebus_queue.name) as sender: + + message_dict = {"bad_key": "Message"} + message2_dict = {"bad_key": "Message2"} + list_message_dicts = [message_dict, message2_dict] + + # send single dict + with pytest.raises(TypeError): + await sender.send_messages(message_dict) + + # send list of dicts + with pytest.raises(TypeError): + await sender.send_messages(list_message_dicts) + + # create and send BatchMessage with dicts + batch_message = await sender.create_message_batch() + with pytest.raises(TypeError): + batch_message._from_list(list_message_dicts) # pylint: disable=protected-access + + @pytest.mark.liveTest + @pytest.mark.live_test_only + @CachedResourceGroupPreparer(name_prefix='servicebustest') + @CachedServiceBusNamespacePreparer(name_prefix='servicebustest') + @ServiceBusQueuePreparer(name_prefix='servicebustest', dead_lettering_on_message_expiration=True) + async def test_queue_async_send_dict_messages_scheduled(self, servicebus_namespace_connection_string, servicebus_queue, **kwargs): + + async with ServiceBusClient.from_connection_string( + servicebus_namespace_connection_string, logging_enable=False) as sb_client: + content = "Test scheduled message" + message_id = uuid.uuid4() + message_id2 = uuid.uuid4() + scheduled_enqueue_time = (utc_now() + timedelta(minutes=0.05)).replace(microsecond=0) + message_dict = {"message_id": message_id, "body": content} + message2_dict = {"message_id": message_id2, "body": content} + list_message_dicts = [message_dict, message2_dict] + + # send single dict + async with sb_client.get_queue_receiver(servicebus_queue.name) as receiver: + async with sb_client.get_queue_sender(servicebus_queue.name) as sender: + tokens = await sender.schedule_messages(message_dict, scheduled_enqueue_time) + assert len(tokens) == 1 + + messages = await receiver.receive_messages(max_wait_time=20) + if messages: + try: + data = str(messages[0]) + assert data == content + assert messages[0].message_id == message_id + assert messages[0].scheduled_enqueue_time_utc == scheduled_enqueue_time + assert messages[0].scheduled_enqueue_time_utc <= messages[0].enqueued_time_utc.replace(microsecond=0) + assert len(messages) == 1 + finally: + for m in messages: + await receiver.complete_message(m) + else: + raise Exception("Failed to receive schdeduled message.") + + # send list of dicts + async with sb_client.get_queue_receiver(servicebus_queue.name, prefetch_count=20) as receiver: + async with sb_client.get_queue_sender(servicebus_queue.name) as sender: + tokens = await sender.schedule_messages(list_message_dicts, scheduled_enqueue_time) + assert len(tokens) == 2 + + messages = await receiver.receive_messages(max_wait_time=20) + messages.extend(await receiver.receive_messages(max_wait_time=5)) + if messages: + try: + data = str(messages[0]) + print(messages) + assert data == content + assert messages[0].message_id == message_id + assert messages[0].scheduled_enqueue_time_utc == scheduled_enqueue_time + assert messages[0].scheduled_enqueue_time_utc <= messages[0].enqueued_time_utc.replace(microsecond=0) + assert len(messages) == 2 + finally: + for m in messages: + await receiver.complete_message(m) + else: + raise Exception("Failed to receive schdeduled message.") + + @pytest.mark.liveTest + @pytest.mark.live_test_only + @CachedResourceGroupPreparer(name_prefix='servicebustest') + @CachedServiceBusNamespacePreparer(name_prefix='servicebustest') + @ServiceBusQueuePreparer(name_prefix='servicebustest', dead_lettering_on_message_expiration=True) + async def test_queue_async_send_dict_messages_scheduled_error_badly_formatted_dicts(self, servicebus_namespace_connection_string, servicebus_queue, **kwargs): + + async with ServiceBusClient.from_connection_string( + servicebus_namespace_connection_string, logging_enable=False) as sb_client: + content = "Test scheduled message" + message_id = uuid.uuid4() + message_id2 = uuid.uuid4() + scheduled_enqueue_time = (utc_now() + timedelta(minutes=0.1)).replace(microsecond=0) + async with sb_client.get_queue_receiver(servicebus_queue.name) as receiver: + async with sb_client.get_queue_sender(servicebus_queue.name) as sender: + message_dict = {"message_id": message_id, "bad_key": content} + message2_dict = {"message_id": message_id2, "bad_key": content} + list_message_dicts = [message_dict, message2_dict] + with pytest.raises(TypeError): + await sender.schedule_messages(message_dict, scheduled_enqueue_time) + with pytest.raises(TypeError): + await sender.schedule_messages(list_message_dicts, scheduled_enqueue_time) diff --git a/sdk/servicebus/azure-servicebus/tests/mgmt_tests/recordings/test_mgmt_queues.test_mgmt_queue_update_dict_error.yaml b/sdk/servicebus/azure-servicebus/tests/mgmt_tests/recordings/test_mgmt_queues.test_mgmt_queue_update_dict_error.yaml new file mode 100644 index 000000000000..86281277f697 --- /dev/null +++ b/sdk/servicebus/azure-servicebus/tests/mgmt_tests/recordings/test_mgmt_queues.test_mgmt_queue_update_dict_error.yaml @@ -0,0 +1,104 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://servicebustestsbname.servicebus.windows.net/$Resources/queues?$skip=0&$top=100&api-version=2017-04 + response: + body: + string: Queueshttps://servicebustest7kbrnosvdj.servicebus.windows.net/$Resources/queues?$skip=0&$top=100&api-version=2017-042021-03-02T19:50:37Z + headers: + content-type: + - application/atom+xml;type=feed;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:50:37 GMT + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 200 + message: OK +- request: + body: ' + + ' + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '248' + Content-Type: + - application/atom+xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/dfjdfj?api-version=2017-04 + response: + body: + string: https://servicebustest7kbrnosvdj.servicebus.windows.net/dfjdfj?api-version=2017-04dfjdfj2021-03-02T19:50:38Z2021-03-02T19:50:38Zservicebustest7kbrnosvdjPT1M1024falsefalseP10675199DT2H48M5.4775807SfalsePT10M10true00falseActive2021-03-02T19:50:38.3Z2021-03-02T19:50:38.38ZtrueP10675199DT2H48M5.4775807SfalseAvailablefalse + headers: + content-type: + - application/atom+xml;type=entry;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:50:38 GMT + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + transfer-encoding: + - chunked + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: DELETE + uri: https://servicebustestsbname.servicebus.windows.net/dfjdfj?api-version=2017-04 + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Tue, 02 Mar 2021 19:50:39 GMT + etag: + - '637503114383800000' + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/servicebus/azure-servicebus/tests/mgmt_tests/recordings/test_mgmt_queues.test_mgmt_queue_update_dict_success.yaml b/sdk/servicebus/azure-servicebus/tests/mgmt_tests/recordings/test_mgmt_queues.test_mgmt_queue_update_dict_success.yaml new file mode 100644 index 000000000000..b66eea67c67c --- /dev/null +++ b/sdk/servicebus/azure-servicebus/tests/mgmt_tests/recordings/test_mgmt_queues.test_mgmt_queue_update_dict_success.yaml @@ -0,0 +1,274 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://servicebustestsbname.servicebus.windows.net/$Resources/queues?$skip=0&$top=100&api-version=2017-04 + response: + body: + string: Queueshttps://servicebustest7kbrnosvdj.servicebus.windows.net/$Resources/queues?$skip=0&$top=100&api-version=2017-042021-03-02T19:50:40Z + headers: + content-type: + - application/atom+xml;type=feed;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:50:39 GMT + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 200 + message: OK +- request: + body: ' + + ' + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '248' + Content-Type: + - application/atom+xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjruid?api-version=2017-04 + response: + body: + string: https://servicebustest7kbrnosvdj.servicebus.windows.net/fjruid?api-version=2017-04fjruid2021-03-02T19:50:40Z2021-03-02T19:50:40Zservicebustest7kbrnosvdjPT1M1024falsefalseP10675199DT2H48M5.4775807SfalsePT10M10true00falseActive2021-03-02T19:50:40.697Z2021-03-02T19:50:40.74ZtrueP10675199DT2H48M5.4775807SfalseAvailablefalse + headers: + content-type: + - application/atom+xml;type=entry;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:50:40 GMT + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + transfer-encoding: + - chunked + status: + code: 201 + message: Created +- request: + body: ' + + PT2M1024falsefalseP10675199DT2H48M5.477539SfalsePT10M10trueActiveP10675199DT2H48M5.477539SfalseAvailablefalse' + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '1022' + Content-Type: + - application/atom+xml + If-Match: + - '*' + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjruid?api-version=2017-04 + response: + body: + string: https://servicebustest7kbrnosvdj.servicebus.windows.net/fjruid?api-version=2017-04fjruid2021-03-02T19:50:41Zservicebustest7kbrnosvdjPT2M1024falsefalseP10675199DT2H48M5.477539SfalsePT10M10trueActiveP10675199DT2H48M5.477539SfalseAvailablefalse + headers: + content-type: + - application/atom+xml;type=entry;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:50:40 GMT + etag: + - '637503114407400000' + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + transfer-encoding: + - chunked + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://servicebustestsbname.servicebus.windows.net/fjruid?enrich=false&api-version=2017-04 + response: + body: + string: https://servicebustest7kbrnosvdj.servicebus.windows.net/fjruid?enrich=false&api-version=2017-04fjruid2021-03-02T19:50:40Z2021-03-02T19:50:41Zservicebustest7kbrnosvdjPT2M1024falsefalseP10675199DT2H48M5.477539SfalsePT10M10true00falseActive2021-03-02T19:50:40.697Z2021-03-02T19:50:41.277Z0001-01-01T00:00:00Ztrue00000P10675199DT2H48M5.477539SfalseAvailablefalse + headers: + content-type: + - application/atom+xml;type=entry;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:50:41 GMT + etag: + - '637503114412770000' + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + transfer-encoding: + - chunked + status: + code: 200 + message: OK +- request: + body: ' + + PT13S3072falsefalsePT11MtruePT12M14trueActivePT10MfalseAvailabletruesb://servicebustest7kbrnosvdj.servicebus.windows.net/fjruidsb://servicebustest7kbrnosvdj.servicebus.windows.net/fjruid' + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '1185' + Content-Type: + - application/atom+xml + If-Match: + - '*' + ServiceBusDlqSupplementaryAuthorization: + - SharedAccessSignature sr=sb%3A%2F%2Fservicebustest7kbrnosvdj.servicebus.windows.net%2Ffjruid&sig=qS2%2b%2bY3MixrsSAgzMuE50KJwDukl6sgu%2fAuohkRKGU0%3d&se=1614718240&skn=RootManageSharedAccessKey + ServiceBusSupplementaryAuthorization: + - SharedAccessSignature sr=sb%3A%2F%2Fservicebustest7kbrnosvdj.servicebus.windows.net%2Ffjruid&sig=qS2%2b%2bY3MixrsSAgzMuE50KJwDukl6sgu%2fAuohkRKGU0%3d&se=1614718240&skn=RootManageSharedAccessKey + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjruid?api-version=2017-04 + response: + body: + string: https://servicebustest7kbrnosvdj.servicebus.windows.net/fjruid?api-version=2017-04fjruid2021-03-02T19:50:41Zservicebustest7kbrnosvdjPT13S3072falsefalsePT11MtruePT12M14trueActivePT10MfalseAvailabletruesb://servicebustest7kbrnosvdj.servicebus.windows.net/fjruidsb://servicebustest7kbrnosvdj.servicebus.windows.net/fjruid + headers: + content-type: + - application/atom+xml;type=entry;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:50:41 GMT + etag: + - '637503114412770000' + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + transfer-encoding: + - chunked + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://servicebustestsbname.servicebus.windows.net/fjruid?enrich=false&api-version=2017-04 + response: + body: + string: https://servicebustest7kbrnosvdj.servicebus.windows.net/fjruid?enrich=false&api-version=2017-04fjruid2021-03-02T19:50:40Z2021-03-02T19:50:41Zservicebustest7kbrnosvdjPT13S3072falsefalsePT11MtruePT12M14true00falseActive2021-03-02T19:50:40.697Z2021-03-02T19:50:41.54Z0001-01-01T00:00:00Ztrue00000PT10MfalseAvailabletruesb://servicebustest7kbrnosvdj.servicebus.windows.net/fjruidsb://servicebustest7kbrnosvdj.servicebus.windows.net/fjruid + headers: + content-type: + - application/atom+xml;type=entry;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:50:41 GMT + etag: + - '637503114415400000' + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + transfer-encoding: + - chunked + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: DELETE + uri: https://servicebustestsbname.servicebus.windows.net/fjruid?api-version=2017-04 + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Tue, 02 Mar 2021 19:50:41 GMT + etag: + - '637503114415400000' + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/servicebus/azure-servicebus/tests/mgmt_tests/recordings/test_mgmt_rules.test_mgmt_rule_update_dict_error.yaml b/sdk/servicebus/azure-servicebus/tests/mgmt_tests/recordings/test_mgmt_rules.test_mgmt_rule_update_dict_error.yaml new file mode 100644 index 000000000000..0c8d733e88c5 --- /dev/null +++ b/sdk/servicebus/azure-servicebus/tests/mgmt_tests/recordings/test_mgmt_rules.test_mgmt_rule_update_dict_error.yaml @@ -0,0 +1,258 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://servicebustestsbname.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-04 + response: + body: + string: Topicshttps://servicebustestqd6kevky7y.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-042021-03-02T19:49:50Z + headers: + content-type: + - application/atom+xml;type=feed;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:49:50 GMT + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 200 + message: OK +- request: + body: ' + + ' + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '248' + Content-Type: + - application/atom+xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjruid?api-version=2017-04 + response: + body: + string: https://servicebustestqd6kevky7y.servicebus.windows.net/fjruid?api-version=2017-04fjruid2021-03-02T19:49:51Z2021-03-02T19:49:51Zservicebustestqd6kevky7yP10675199DT2H48M5.4775807S1024falsePT10Mtrue0falsefalseActive2021-03-02T19:49:51.13Z2021-03-02T19:49:51.21ZtrueP10675199DT2H48M5.4775807SfalseAvailablefalsefalse + headers: + content-type: + - application/atom+xml;type=entry;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:49:51 GMT + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + transfer-encoding: + - chunked + status: + code: 201 + message: Created +- request: + body: ' + + ' + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '255' + Content-Type: + - application/atom+xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjruid/subscriptions/eqkovcd?api-version=2017-04 + response: + body: + string: https://servicebustestqd6kevky7y.servicebus.windows.net/fjruid/subscriptions/eqkovcd?api-version=2017-04eqkovcd2021-03-02T19:49:51Z2021-03-02T19:49:51ZPT1MfalseP10675199DT2H48M5.4775807Sfalsetrue010trueActive2021-03-02T19:49:51.7058503Z2021-03-02T19:49:51.7058503Z0001-01-01T00:00:00P10675199DT2H48M5.4775807SAvailable + headers: + content-type: + - application/atom+xml;type=entry;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:49:51 GMT + etag: + - '637503113912100000' + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + transfer-encoding: + - chunked + status: + code: 201 + message: Created +- request: + body: ' + + Priority = ''low''20truerule' + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '550' + Content-Type: + - application/atom+xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjruid/subscriptions/eqkovcd/rules/rule?api-version=2017-04 + response: + body: + string: https://servicebustestqd6kevky7y.servicebus.windows.net/fjruid/subscriptions/eqkovcd/rules/rule?api-version=2017-04rule2021-03-02T19:49:52Z2021-03-02T19:49:52ZPriority + = 'low'20true2021-03-02T19:49:52.0027557Zrule + headers: + content-type: + - application/atom+xml;type=entry;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:49:51 GMT + etag: + - '637503113912100000' + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + transfer-encoding: + - chunked + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: DELETE + uri: https://servicebustestsbname.servicebus.windows.net/fjruid/subscriptions/eqkovcd/rules/rule?api-version=2017-04 + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Tue, 02 Mar 2021 19:49:52 GMT + etag: + - '637503113912100000' + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: DELETE + uri: https://servicebustestsbname.servicebus.windows.net/fjruid/subscriptions/eqkovcd?api-version=2017-04 + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Tue, 02 Mar 2021 19:49:52 GMT + etag: + - '637503113912100000' + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: DELETE + uri: https://servicebustestsbname.servicebus.windows.net/fjruid?api-version=2017-04 + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Tue, 02 Mar 2021 19:49:52 GMT + etag: + - '637503113912100000' + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/servicebus/azure-servicebus/tests/mgmt_tests/recordings/test_mgmt_rules.test_mgmt_rule_update_dict_success.yaml b/sdk/servicebus/azure-servicebus/tests/mgmt_tests/recordings/test_mgmt_rules.test_mgmt_rule_update_dict_success.yaml new file mode 100644 index 000000000000..d413ea948803 --- /dev/null +++ b/sdk/servicebus/azure-servicebus/tests/mgmt_tests/recordings/test_mgmt_rules.test_mgmt_rule_update_dict_success.yaml @@ -0,0 +1,381 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://servicebustestsbname.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-04 + response: + body: + string: Topicshttps://servicebustestqd6kevky7y.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-042021-03-02T19:49:53Z + headers: + content-type: + - application/atom+xml;type=feed;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:49:53 GMT + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 200 + message: OK +- request: + body: ' + + ' + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '248' + Content-Type: + - application/atom+xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjruid?api-version=2017-04 + response: + body: + string: https://servicebustestqd6kevky7y.servicebus.windows.net/fjruid?api-version=2017-04fjruid2021-03-02T19:49:54Z2021-03-02T19:49:54Zservicebustestqd6kevky7yP10675199DT2H48M5.4775807S1024falsePT10Mtrue0falsefalseActive2021-03-02T19:49:54.193Z2021-03-02T19:49:54.223ZtrueP10675199DT2H48M5.4775807SfalseAvailablefalsefalse + headers: + content-type: + - application/atom+xml;type=entry;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:49:54 GMT + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + transfer-encoding: + - chunked + status: + code: 201 + message: Created +- request: + body: ' + + ' + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '255' + Content-Type: + - application/atom+xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjruid/subscriptions/eqkovcd?api-version=2017-04 + response: + body: + string: https://servicebustestqd6kevky7y.servicebus.windows.net/fjruid/subscriptions/eqkovcd?api-version=2017-04eqkovcd2021-03-02T19:49:54Z2021-03-02T19:49:54ZPT1MfalseP10675199DT2H48M5.4775807Sfalsetrue010trueActive2021-03-02T19:49:54.7526704Z2021-03-02T19:49:54.7526704Z0001-01-01T00:00:00P10675199DT2H48M5.4775807SAvailable + headers: + content-type: + - application/atom+xml;type=entry;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:49:54 GMT + etag: + - '637503113942230000' + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + transfer-encoding: + - chunked + status: + code: 201 + message: Created +- request: + body: ' + + Priority = ''low''20truerule' + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '550' + Content-Type: + - application/atom+xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjruid/subscriptions/eqkovcd/rules/rule?api-version=2017-04 + response: + body: + string: https://servicebustestqd6kevky7y.servicebus.windows.net/fjruid/subscriptions/eqkovcd/rules/rule?api-version=2017-04rule2021-03-02T19:49:55Z2021-03-02T19:49:55ZPriority + = 'low'20true2021-03-02T19:49:55.0807876Zrule + headers: + content-type: + - application/atom+xml;type=entry;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:49:54 GMT + etag: + - '637503113942230000' + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + transfer-encoding: + - chunked + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://servicebustestsbname.servicebus.windows.net/fjruid/subscriptions/eqkovcd/rules/rule?enrich=false&api-version=2017-04 + response: + body: + string: sb://servicebustestqd6kevky7y.servicebus.windows.net/fjruid/subscriptions/eqkovcd/rules/rule?enrich=false&api-version=2017-04rule2021-03-02T19:49:55Z2021-03-02T19:49:55ZPriority + = 'low'20true2021-03-02T19:49:55.0884104Zrule + headers: + content-type: + - application/atom+xml;type=entry;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:49:54 GMT + etag: + - '637503113942230000' + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + transfer-encoding: + - chunked + status: + code: 200 + message: OK +- request: + body: ' + + testcidSET Priority = ''low''20true2021-03-02T19:49:55.08841Zrule' + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '654' + Content-Type: + - application/atom+xml + If-Match: + - '*' + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjruid/subscriptions/eqkovcd/rules/rule?api-version=2017-04 + response: + body: + string: https://servicebustestqd6kevky7y.servicebus.windows.net/fjruid/subscriptions/eqkovcd/rules/rule?api-version=2017-04rule2021-03-02T19:49:55Z2021-03-02T19:49:55ZtestcidSET Priority = 'low'20true2021-03-02T19:49:55.3932669Zrule + headers: + content-type: + - application/atom+xml;type=entry;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:49:54 GMT + etag: + - '637503113942230000' + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + transfer-encoding: + - chunked + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://servicebustestsbname.servicebus.windows.net/fjruid/subscriptions/eqkovcd/rules/rule?enrich=false&api-version=2017-04 + response: + body: + string: sb://servicebustestqd6kevky7y.servicebus.windows.net/fjruid/subscriptions/eqkovcd/rules/rule?enrich=false&api-version=2017-04rule2021-03-02T19:49:55Z2021-03-02T19:49:55ZtestcidSET Priority = 'low'20true2021-03-02T19:49:55.0884104Zrule + headers: + content-type: + - application/atom+xml;type=entry;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:49:54 GMT + etag: + - '637503113942230000' + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + transfer-encoding: + - chunked + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: DELETE + uri: https://servicebustestsbname.servicebus.windows.net/fjruid/subscriptions/eqkovcd/rules/rule?api-version=2017-04 + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Tue, 02 Mar 2021 19:49:55 GMT + etag: + - '637503113942230000' + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: DELETE + uri: https://servicebustestsbname.servicebus.windows.net/fjruid/subscriptions/eqkovcd?api-version=2017-04 + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Tue, 02 Mar 2021 19:49:55 GMT + etag: + - '637503113942230000' + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: DELETE + uri: https://servicebustestsbname.servicebus.windows.net/fjruid?api-version=2017-04 + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Tue, 02 Mar 2021 19:49:55 GMT + etag: + - '637503113942230000' + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/servicebus/azure-servicebus/tests/mgmt_tests/recordings/test_mgmt_subscriptions.test_mgmt_subscription_update_dict_error.yaml b/sdk/servicebus/azure-servicebus/tests/mgmt_tests/recordings/test_mgmt_subscriptions.test_mgmt_subscription_update_dict_error.yaml new file mode 100644 index 000000000000..970b238060be --- /dev/null +++ b/sdk/servicebus/azure-servicebus/tests/mgmt_tests/recordings/test_mgmt_subscriptions.test_mgmt_subscription_update_dict_error.yaml @@ -0,0 +1,179 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://servicebustestsbname.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-04 + response: + body: + string: Topicshttps://servicebustestnkxyo36wpb.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-042021-03-02T19:51:48Z + headers: + content-type: + - application/atom+xml;type=feed;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:51:48 GMT + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 200 + message: OK +- request: + body: ' + + ' + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '248' + Content-Type: + - application/atom+xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/dfjdfj?api-version=2017-04 + response: + body: + string: https://servicebustestnkxyo36wpb.servicebus.windows.net/dfjdfj?api-version=2017-04dfjdfj2021-03-02T19:51:48Z2021-03-02T19:51:48Zservicebustestnkxyo36wpbP10675199DT2H48M5.4775807S1024falsePT10Mtrue0falsefalseActive2021-03-02T19:51:48.493Z2021-03-02T19:51:48.56ZtrueP10675199DT2H48M5.4775807SfalseAvailablefalsefalse + headers: + content-type: + - application/atom+xml;type=entry;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:51:48 GMT + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + transfer-encoding: + - chunked + status: + code: 201 + message: Created +- request: + body: ' + + ' + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '255' + Content-Type: + - application/atom+xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/dfjdfj/subscriptions/kwqxd?api-version=2017-04 + response: + body: + string: https://servicebustestnkxyo36wpb.servicebus.windows.net/dfjdfj/subscriptions/kwqxd?api-version=2017-04kwqxd2021-03-02T19:51:49Z2021-03-02T19:51:49ZPT1MfalseP10675199DT2H48M5.4775807Sfalsetrue010trueActive2021-03-02T19:51:49.0648439Z2021-03-02T19:51:49.0648439Z0001-01-01T00:00:00P10675199DT2H48M5.4775807SAvailable + headers: + content-type: + - application/atom+xml;type=entry;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:51:49 GMT + etag: + - '637503115085600000' + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + transfer-encoding: + - chunked + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: DELETE + uri: https://servicebustestsbname.servicebus.windows.net/dfjdfj/subscriptions/kwqxd?api-version=2017-04 + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Tue, 02 Mar 2021 19:51:49 GMT + etag: + - '637503115085600000' + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: DELETE + uri: https://servicebustestsbname.servicebus.windows.net/dfjdfj?api-version=2017-04 + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Tue, 02 Mar 2021 19:51:49 GMT + etag: + - '637503115085600000' + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/servicebus/azure-servicebus/tests/mgmt_tests/recordings/test_mgmt_subscriptions.test_mgmt_subscription_update_dict_success.yaml b/sdk/servicebus/azure-servicebus/tests/mgmt_tests/recordings/test_mgmt_subscriptions.test_mgmt_subscription_update_dict_success.yaml new file mode 100644 index 000000000000..d60e109c5d9f --- /dev/null +++ b/sdk/servicebus/azure-servicebus/tests/mgmt_tests/recordings/test_mgmt_subscriptions.test_mgmt_subscription_update_dict_success.yaml @@ -0,0 +1,429 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://servicebustestsbname.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-04 + response: + body: + string: Topicshttps://servicebustestnkxyo36wpb.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-042021-03-02T19:51:50Z + headers: + content-type: + - application/atom+xml;type=feed;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:51:50 GMT + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 200 + message: OK +- request: + body: ' + + ' + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '248' + Content-Type: + - application/atom+xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjruid?api-version=2017-04 + response: + body: + string: https://servicebustestnkxyo36wpb.servicebus.windows.net/fjruid?api-version=2017-04fjruid2021-03-02T19:51:51Z2021-03-02T19:51:51Zservicebustestnkxyo36wpbP10675199DT2H48M5.4775807S1024falsePT10Mtrue0falsefalseActive2021-03-02T19:51:51.15Z2021-03-02T19:51:51.23ZtrueP10675199DT2H48M5.4775807SfalseAvailablefalsefalse + headers: + content-type: + - application/atom+xml;type=entry;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:51:51 GMT + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + transfer-encoding: + - chunked + status: + code: 201 + message: Created +- request: + body: ' + + ' + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '255' + Content-Type: + - application/atom+xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjruid/subscriptions/eqkovcd?api-version=2017-04 + response: + body: + string: https://servicebustestnkxyo36wpb.servicebus.windows.net/fjruid/subscriptions/eqkovcd?api-version=2017-04eqkovcd2021-03-02T19:51:51Z2021-03-02T19:51:51ZPT1MfalseP10675199DT2H48M5.4775807Sfalsetrue010trueActive2021-03-02T19:51:51.7276022Z2021-03-02T19:51:51.7276022Z0001-01-01T00:00:00P10675199DT2H48M5.4775807SAvailable + headers: + content-type: + - application/atom+xml;type=entry;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:51:51 GMT + etag: + - '637503115112300000' + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + transfer-encoding: + - chunked + status: + code: 201 + message: Created +- request: + body: ' + + PT2MfalseP10675199DT2H48M5.477539Sfalsetrue10trueActiveP10675199DT2H48M5.477539SAvailable' + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '836' + Content-Type: + - application/atom+xml + If-Match: + - '*' + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjruid/subscriptions/eqkovcd?api-version=2017-04 + response: + body: + string: https://servicebustestnkxyo36wpb.servicebus.windows.net/fjruid/subscriptions/eqkovcd?api-version=2017-04eqkovcd2021-03-02T19:51:52Z2021-03-02T19:51:52ZPT2MfalseP10675199DT2H48M5.477539Sfalsetrue010trueActive2021-03-02T19:51:52.0088215Z2021-03-02T19:51:52.0088215Z0001-01-01T00:00:00P10675199DT2H48M5.477539SAvailable + headers: + content-type: + - application/atom+xml;type=entry;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:51:51 GMT + etag: + - '637503115112300000' + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + transfer-encoding: + - chunked + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://servicebustestsbname.servicebus.windows.net/fjruid/subscriptions/eqkovcd?enrich=false&api-version=2017-04 + response: + body: + string: sb://servicebustestnkxyo36wpb.servicebus.windows.net/fjruid/subscriptions/eqkovcd?enrich=false&api-version=2017-04eqkovcd2021-03-02T19:51:51Z2021-03-02T19:51:52ZPT2MfalseP10675199DT2H48M5.477539Sfalsetrue010trueActive2021-03-02T19:51:51.7272898Z2021-03-02T19:51:52.1803839Z2021-03-02T19:51:51.7272898Z00000P10675199DT2H48M5.477539SAvailable + headers: + content-type: + - application/atom+xml;type=entry;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:51:51 GMT + etag: + - '637503115112300000' + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + transfer-encoding: + - chunked + status: + code: 200 + message: OK +- request: + body: ' + + PT12SfalsePT11Mtruetrue14trueActivePT10MAvailable' + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '796' + Content-Type: + - application/atom+xml + If-Match: + - '*' + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjruid/subscriptions/eqkovcd?api-version=2017-04 + response: + body: + string: https://servicebustestnkxyo36wpb.servicebus.windows.net/fjruid/subscriptions/eqkovcd?api-version=2017-04eqkovcd2021-03-02T19:51:52Z2021-03-02T19:51:52ZPT12SfalsePT11Mtruetrue014trueActive2021-03-02T19:51:52.4306993Z2021-03-02T19:51:52.4306993Z0001-01-01T00:00:00PT10MAvailable + headers: + content-type: + - application/atom+xml;type=entry;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:51:52 GMT + etag: + - '637503115112300000' + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + transfer-encoding: + - chunked + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://servicebustestsbname.servicebus.windows.net/fjruid/subscriptions/eqkovcd?enrich=false&api-version=2017-04 + response: + body: + string: sb://servicebustestnkxyo36wpb.servicebus.windows.net/fjruid/subscriptions/eqkovcd?enrich=false&api-version=2017-04eqkovcd2021-03-02T19:51:51Z2021-03-02T19:51:52ZPT12SfalsePT11Mtruetrue014trueActive2021-03-02T19:51:51.7272898Z2021-03-02T19:51:52.430416Z2021-03-02T19:51:51.7272898Z00000PT10MAvailable + headers: + content-type: + - application/atom+xml;type=entry;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:51:52 GMT + etag: + - '637503115112300000' + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + transfer-encoding: + - chunked + status: + code: 200 + message: OK +- request: + body: ' + + PT12SfalsePT11Mtruetrue14trueActivesb://servicebustestnkxyo36wpb.servicebus.windows.net/fjruidsb://servicebustestnkxyo36wpb.servicebus.windows.net/fjruidPT10MAvailable' + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '1000' + Content-Type: + - application/atom+xml + If-Match: + - '*' + ServiceBusDlqSupplementaryAuthorization: + - SharedAccessSignature sr=sb%3A%2F%2Fservicebustestnkxyo36wpb.servicebus.windows.net%2Ffjruid&sig=0ptYwRjZfISzRAtqHGhoVbMF6wWu5io4DKGQkiQebOk%3d&se=1614718311&skn=RootManageSharedAccessKey + ServiceBusSupplementaryAuthorization: + - SharedAccessSignature sr=sb%3A%2F%2Fservicebustestnkxyo36wpb.servicebus.windows.net%2Ffjruid&sig=0ptYwRjZfISzRAtqHGhoVbMF6wWu5io4DKGQkiQebOk%3d&se=1614718311&skn=RootManageSharedAccessKey + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjruid/subscriptions/eqkovcd?api-version=2017-04 + response: + body: + string: https://servicebustestnkxyo36wpb.servicebus.windows.net/fjruid/subscriptions/eqkovcd?api-version=2017-04eqkovcd2021-03-02T19:51:52Z2021-03-02T19:51:52ZPT12SfalsePT11Mtruetrue014trueActivesb://servicebustestnkxyo36wpb.servicebus.windows.net/fjruid2021-03-02T19:51:52.6807376Z2021-03-02T19:51:52.6807376Z0001-01-01T00:00:00sb://servicebustestnkxyo36wpb.servicebus.windows.net/fjruidP10675199DT2H48M5.4775807SAvailable + headers: + content-type: + - application/atom+xml;type=entry;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:51:52 GMT + etag: + - '637503115112300000' + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + transfer-encoding: + - chunked + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://servicebustestsbname.servicebus.windows.net/fjruid/subscriptions/eqkovcd?enrich=false&api-version=2017-04 + response: + body: + string: sb://servicebustestnkxyo36wpb.servicebus.windows.net/fjruid/subscriptions/eqkovcd?enrich=false&api-version=2017-04eqkovcd2021-03-02T19:51:51Z2021-03-02T19:51:52ZPT12SfalsePT11Mtruetrue014trueActivesb://servicebustestnkxyo36wpb.servicebus.windows.net/fjruid2021-03-02T19:51:51.7272898Z2021-03-02T19:51:52.7116789Z2021-03-02T19:51:51.7272898Z00000sb://servicebustestnkxyo36wpb.servicebus.windows.net/fjruidP10675199DT2H48M5.4775807SAvailable + headers: + content-type: + - application/atom+xml;type=entry;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:51:52 GMT + etag: + - '637503115112300000' + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + transfer-encoding: + - chunked + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: DELETE + uri: https://servicebustestsbname.servicebus.windows.net/fjruid/subscriptions/eqkovcd?api-version=2017-04 + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Tue, 02 Mar 2021 19:51:52 GMT + etag: + - '637503115112300000' + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: DELETE + uri: https://servicebustestsbname.servicebus.windows.net/fjruid?api-version=2017-04 + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Tue, 02 Mar 2021 19:51:53 GMT + etag: + - '637503115112300000' + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/servicebus/azure-servicebus/tests/mgmt_tests/recordings/test_mgmt_topics.test_mgmt_topic_update_dict_error.yaml b/sdk/servicebus/azure-servicebus/tests/mgmt_tests/recordings/test_mgmt_topics.test_mgmt_topic_update_dict_error.yaml new file mode 100644 index 000000000000..adbecf008433 --- /dev/null +++ b/sdk/servicebus/azure-servicebus/tests/mgmt_tests/recordings/test_mgmt_topics.test_mgmt_topic_update_dict_error.yaml @@ -0,0 +1,104 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://servicebustestsbname.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-04 + response: + body: + string: Topicshttps://servicebustestrzdukahnat.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-042021-03-02T19:52:13Z + headers: + content-type: + - application/atom+xml;type=feed;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:52:12 GMT + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 200 + message: OK +- request: + body: ' + + ' + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '248' + Content-Type: + - application/atom+xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/dfjdfj?api-version=2017-04 + response: + body: + string: https://servicebustestrzdukahnat.servicebus.windows.net/dfjdfj?api-version=2017-04dfjdfj2021-03-02T19:52:13Z2021-03-02T19:52:13ZservicebustestrzdukahnatP10675199DT2H48M5.4775807S1024falsePT10Mtrue0falsefalseActive2021-03-02T19:52:13.657Z2021-03-02T19:52:13.697ZtrueP10675199DT2H48M5.4775807SfalseAvailablefalsefalse + headers: + content-type: + - application/atom+xml;type=entry;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:52:13 GMT + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + transfer-encoding: + - chunked + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: DELETE + uri: https://servicebustestsbname.servicebus.windows.net/dfjdfj?api-version=2017-04 + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Tue, 02 Mar 2021 19:52:13 GMT + etag: + - '637503115336970000' + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/servicebus/azure-servicebus/tests/mgmt_tests/recordings/test_mgmt_topics.test_mgmt_topic_update_dict_success.yaml b/sdk/servicebus/azure-servicebus/tests/mgmt_tests/recordings/test_mgmt_topics.test_mgmt_topic_update_dict_success.yaml new file mode 100644 index 000000000000..111aa9c7038e --- /dev/null +++ b/sdk/servicebus/azure-servicebus/tests/mgmt_tests/recordings/test_mgmt_topics.test_mgmt_topic_update_dict_success.yaml @@ -0,0 +1,270 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://servicebustestsbname.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-04 + response: + body: + string: Topicshttps://servicebustestrzdukahnat.servicebus.windows.net/$Resources/topics?$skip=0&$top=100&api-version=2017-042021-03-02T19:52:15Z + headers: + content-type: + - application/atom+xml;type=feed;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:52:15 GMT + server: + - Microsoft-HTTPAPI/2.0 + transfer-encoding: + - chunked + status: + code: 200 + message: OK +- request: + body: ' + + ' + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '248' + Content-Type: + - application/atom+xml + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjruid?api-version=2017-04 + response: + body: + string: https://servicebustestrzdukahnat.servicebus.windows.net/fjruid?api-version=2017-04fjruid2021-03-02T19:52:15Z2021-03-02T19:52:15ZservicebustestrzdukahnatP10675199DT2H48M5.4775807S1024falsePT10Mtrue0falsefalseActive2021-03-02T19:52:15.907Z2021-03-02T19:52:15.957ZtrueP10675199DT2H48M5.4775807SfalseAvailablefalsefalse + headers: + content-type: + - application/atom+xml;type=entry;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:52:15 GMT + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + transfer-encoding: + - chunked + status: + code: 201 + message: Created +- request: + body: ' + + PT2M1024falsePT10Mtrue0ActivetrueP10675199DT2H48M5.477539SfalseAvailablefalse' + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '882' + Content-Type: + - application/atom+xml + If-Match: + - '*' + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjruid?api-version=2017-04 + response: + body: + string: https://servicebustestrzdukahnat.servicebus.windows.net/fjruid?api-version=2017-04fjruid2021-03-02T19:52:16ZservicebustestrzdukahnatPT2M1024falsePT10Mtrue0ActivetrueP10675199DT2H48M5.477539SfalseAvailablefalse + headers: + content-type: + - application/atom+xml;type=entry;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:52:16 GMT + etag: + - '637503115359570000' + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + transfer-encoding: + - chunked + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://servicebustestsbname.servicebus.windows.net/fjruid?enrich=false&api-version=2017-04 + response: + body: + string: https://servicebustestrzdukahnat.servicebus.windows.net/fjruid?enrich=false&api-version=2017-04fjruid2021-03-02T19:52:15Z2021-03-02T19:52:16ZservicebustestrzdukahnatPT2M1024falsePT10Mtrue0falsefalseActive2021-03-02T19:52:15.907Z2021-03-02T19:52:16.49Z0001-01-01T00:00:00Ztrue000000P10675199DT2H48M5.477539SfalseAvailablefalsefalse + headers: + content-type: + - application/atom+xml;type=entry;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:52:16 GMT + etag: + - '637503115364900000' + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + transfer-encoding: + - chunked + status: + code: 200 + message: OK +- request: + body: ' + + PT11M3072falsePT12Mtrue0ActivetruePT10MfalseAvailabletrue' + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '862' + Content-Type: + - application/atom+xml + If-Match: + - '*' + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://servicebustestsbname.servicebus.windows.net/fjruid?api-version=2017-04 + response: + body: + string: https://servicebustestrzdukahnat.servicebus.windows.net/fjruid?api-version=2017-04fjruid2021-03-02T19:52:16ZservicebustestrzdukahnatPT11M3072falsePT12Mtrue0ActivetruePT10MfalseAvailabletrue + headers: + content-type: + - application/atom+xml;type=entry;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:52:16 GMT + etag: + - '637503115364900000' + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + transfer-encoding: + - chunked + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://servicebustestsbname.servicebus.windows.net/fjruid?enrich=false&api-version=2017-04 + response: + body: + string: https://servicebustestrzdukahnat.servicebus.windows.net/fjruid?enrich=false&api-version=2017-04fjruid2021-03-02T19:52:15Z2021-03-02T19:52:16ZservicebustestrzdukahnatPT11M3072falsePT12Mtrue0falsefalseActive2021-03-02T19:52:15.907Z2021-03-02T19:52:16.947Z0001-01-01T00:00:00Ztrue000000PT10MfalseAvailablefalsetrue + headers: + content-type: + - application/atom+xml;type=entry;charset=utf-8 + date: + - Tue, 02 Mar 2021 19:52:16 GMT + etag: + - '637503115369470000' + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + transfer-encoding: + - chunked + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/xml + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-servicebusmanagementclient/2017-04 Python/3.7.0 (Windows-10-10.0.19041-SP0) + method: DELETE + uri: https://servicebustestsbname.servicebus.windows.net/fjruid?api-version=2017-04 + response: + body: + string: '' + headers: + content-length: + - '0' + date: + - Tue, 02 Mar 2021 19:52:17 GMT + etag: + - '637503115369470000' + server: + - Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000 + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/servicebus/azure-servicebus/tests/mgmt_tests/test_mgmt_queues.py b/sdk/servicebus/azure-servicebus/tests/mgmt_tests/test_mgmt_queues.py index a62232a300b4..a7c96031a227 100644 --- a/sdk/servicebus/azure-servicebus/tests/mgmt_tests/test_mgmt_queues.py +++ b/sdk/servicebus/azure-servicebus/tests/mgmt_tests/test_mgmt_queues.py @@ -473,3 +473,74 @@ def test_mgmt_queue_get_runtime_properties_negative(self, servicebus_namespace_c def test_queue_properties_constructor(self): with pytest.raises(TypeError): QueueProperties("randomname") + + @pytest.mark.liveTest + @CachedResourceGroupPreparer(name_prefix='servicebustest') + @CachedServiceBusNamespacePreparer(name_prefix='servicebustest') + def test_mgmt_queue_update_dict_success(self, servicebus_namespace_connection_string, servicebus_namespace, **kwargs): + mgmt_service = ServiceBusAdministrationClient.from_connection_string(servicebus_namespace_connection_string) + clear_queues(mgmt_service) + queue_name = "fjruid" + queue_description = mgmt_service.create_queue(queue_name) + queue_description_dict = dict(queue_description) + try: + # Try updating one setting. + queue_description_dict["lock_duration"] = datetime.timedelta(minutes=2) + mgmt_service.update_queue(queue_description_dict) + + queue_description = mgmt_service.get_queue(queue_name) + assert queue_description.lock_duration == datetime.timedelta(minutes=2) + + # Now try updating all settings. + queue_description_dict = dict(queue_description) + queue_description_dict["auto_delete_on_idle"] = datetime.timedelta(minutes=10) + queue_description_dict["dead_lettering_on_message_expiration"] = True + queue_description_dict["default_message_time_to_live"] = datetime.timedelta(minutes=11) + queue_description_dict["duplicate_detection_history_time_window"] = datetime.timedelta(minutes=12) + queue_description_dict["enable_batched_operations"] = True + queue_description_dict["enable_express"] = True + #queue_description_dict["enable_partitioning"] = True # Cannot be changed after creation + queue_description_dict["lock_duration"] = datetime.timedelta(seconds=13) + queue_description_dict["max_delivery_count"] = 14 + queue_description_dict["max_size_in_megabytes"] = 3072 + queue_description_dict["forward_to"] = "sb://{}.servicebus.windows.net/{}".format(servicebus_namespace.name, queue_name) + queue_description_dict["forward_dead_lettered_messages_to"] = "sb://{}.servicebus.windows.net/{}".format(servicebus_namespace.name, queue_name) + #queue_description_dict["requires_duplicate_detection"] = True # Read only + #queue_description_dict["requires_session"] = True # Cannot be changed after creation + + mgmt_service.update_queue(queue_description_dict) + queue_description = mgmt_service.get_queue(queue_name) + + assert queue_description.auto_delete_on_idle == datetime.timedelta(minutes=10) + assert queue_description.dead_lettering_on_message_expiration == True + assert queue_description.default_message_time_to_live == datetime.timedelta(minutes=11) + assert queue_description.duplicate_detection_history_time_window == datetime.timedelta(minutes=12) + assert queue_description.enable_batched_operations == True + assert queue_description.enable_express == True + #assert queue_description.enable_partitioning == True + assert queue_description.lock_duration == datetime.timedelta(seconds=13) + assert queue_description.max_delivery_count == 14 + assert queue_description.max_size_in_megabytes == 3072 + # Note: We endswith to avoid the fact that the servicebus_namespace_name is replacered locally but not in the properties bag, and still test this. + assert queue_description.forward_to.endswith(".servicebus.windows.net/{}".format(queue_name)) + assert queue_description.forward_dead_lettered_messages_to.endswith(".servicebus.windows.net/{}".format(queue_name)) + #assert queue_description.requires_duplicate_detection == True + #assert queue_description.requires_session == True + finally: + mgmt_service.delete_queue(queue_name) + + @pytest.mark.liveTest + @CachedResourceGroupPreparer(name_prefix='servicebustest') + @CachedServiceBusNamespacePreparer(name_prefix='servicebustest') + def test_mgmt_queue_update_dict_error(self, servicebus_namespace_connection_string, **kwargs): + mgmt_service = ServiceBusAdministrationClient.from_connection_string(servicebus_namespace_connection_string) + clear_queues(mgmt_service) + queue_name = "dfjdfj" + queue_description = mgmt_service.create_queue(queue_name) + # send in queue dict without non-name keyword args + queue_description_only_name = {"name": queue_name} + try: + with pytest.raises(TypeError): + mgmt_service.update_queue(queue_description_only_name) + finally: + mgmt_service.delete_queue(queue_name) diff --git a/sdk/servicebus/azure-servicebus/tests/mgmt_tests/test_mgmt_rules.py b/sdk/servicebus/azure-servicebus/tests/mgmt_tests/test_mgmt_rules.py index 915754c56bac..0e4d00fdcb35 100644 --- a/sdk/servicebus/azure-servicebus/tests/mgmt_tests/test_mgmt_rules.py +++ b/sdk/servicebus/azure-servicebus/tests/mgmt_tests/test_mgmt_rules.py @@ -265,3 +265,66 @@ def test_mgmt_rule_list_and_delete(self, servicebus_namespace_connection_string) def test_rule_properties_constructor(self): with pytest.raises(TypeError): RuleProperties("randomname") + + @CachedResourceGroupPreparer(name_prefix='servicebustest') + @CachedServiceBusNamespacePreparer(name_prefix='servicebustest') + def test_mgmt_rule_update_dict_success(self, servicebus_namespace_connection_string, **kwargs): + mgmt_service = ServiceBusAdministrationClient.from_connection_string(servicebus_namespace_connection_string) + clear_topics(mgmt_service) + topic_name = "fjruid" + subscription_name = "eqkovcd" + rule_name = 'rule' + sql_filter = SqlRuleFilter("Priority = 'low'") + + try: + topic_description = mgmt_service.create_topic(topic_name) + subscription_description = mgmt_service.create_subscription(topic_description.name, subscription_name) + mgmt_service.create_rule(topic_name, subscription_name, rule_name, filter=sql_filter) + + rule_desc = mgmt_service.get_rule(topic_name, subscription_name, rule_name) + + assert type(rule_desc.filter) == SqlRuleFilter + assert rule_desc.filter.sql_expression == "Priority = 'low'" + + correlation_fitler = CorrelationRuleFilter(correlation_id='testcid') + sql_rule_action = SqlRuleAction(sql_expression="SET Priority = 'low'") + + rule_desc.filter = correlation_fitler + rule_desc.action = sql_rule_action + rule_desc_dict = dict(rule_desc) + mgmt_service.update_rule(topic_description.name, subscription_description.name, rule_desc_dict) + + rule_desc = mgmt_service.get_rule(topic_name, subscription_name, rule_name) + assert type(rule_desc.filter) == CorrelationRuleFilter + assert rule_desc.filter.correlation_id == 'testcid' + assert rule_desc.action.sql_expression == "SET Priority = 'low'" + + finally: + mgmt_service.delete_rule(topic_name, subscription_name, rule_name) + mgmt_service.delete_subscription(topic_name, subscription_name) + mgmt_service.delete_topic(topic_name) + + @CachedResourceGroupPreparer(name_prefix='servicebustest') + @CachedServiceBusNamespacePreparer(name_prefix='servicebustest') + def test_mgmt_rule_update_dict_error(self, servicebus_namespace_connection_string, **kwargs): + mgmt_service = ServiceBusAdministrationClient.from_connection_string(servicebus_namespace_connection_string) + clear_topics(mgmt_service) + topic_name = "fjruid" + subscription_name = "eqkovcd" + rule_name = 'rule' + sql_filter = SqlRuleFilter("Priority = 'low'") + + try: + topic_description = mgmt_service.create_topic(topic_name) + subscription_description = mgmt_service.create_subscription(topic_description.name, subscription_name) + mgmt_service.create_rule(topic_name, subscription_name, rule_name, filter=sql_filter) + + # send in rule dict without non-name keyword args + rule_description_only_name = {"name": topic_name} + with pytest.raises(TypeError): + mgmt_service.update_rule(topic_description.name, subscription_description.name, rule_description_only_name) + + finally: + mgmt_service.delete_rule(topic_name, subscription_name, rule_name) + mgmt_service.delete_subscription(topic_name, subscription_name) + mgmt_service.delete_topic(topic_name) diff --git a/sdk/servicebus/azure-servicebus/tests/mgmt_tests/test_mgmt_subscriptions.py b/sdk/servicebus/azure-servicebus/tests/mgmt_tests/test_mgmt_subscriptions.py index 1a9f022f627a..a5833a7a5eee 100644 --- a/sdk/servicebus/azure-servicebus/tests/mgmt_tests/test_mgmt_subscriptions.py +++ b/sdk/servicebus/azure-servicebus/tests/mgmt_tests/test_mgmt_subscriptions.py @@ -305,3 +305,76 @@ def test_mgmt_subscription_get_runtime_properties_basic(self, servicebus_namespa def test_subscription_properties_constructor(self): with pytest.raises(TypeError): SubscriptionProperties("randomname") + + @CachedResourceGroupPreparer(name_prefix='servicebustest') + @CachedServiceBusNamespacePreparer(name_prefix='servicebustest') + def test_mgmt_subscription_update_dict_success(self, servicebus_namespace_connection_string, servicebus_namespace, **kwargs): + mgmt_service = ServiceBusAdministrationClient.from_connection_string(servicebus_namespace_connection_string) + clear_topics(mgmt_service) + topic_name = "fjruid" + subscription_name = "eqkovcd" + + try: + topic_description = mgmt_service.create_topic(topic_name) + subscription_description = mgmt_service.create_subscription(topic_description.name, subscription_name) + subscription_description_dict = dict(subscription_description) + + # Try updating one setting. + subscription_description_dict["lock_duration"] = datetime.timedelta(minutes=2) + mgmt_service.update_subscription(topic_description.name, subscription_description_dict) + subscription_description = mgmt_service.get_subscription(topic_name, subscription_name) + assert subscription_description.lock_duration == datetime.timedelta(minutes=2) + + # Now try updating all settings. + subscription_description_dict = dict(subscription_description) + subscription_description_dict["auto_delete_on_idle"] = datetime.timedelta(minutes=10) + subscription_description_dict["dead_lettering_on_message_expiration"] = True + subscription_description_dict["default_message_time_to_live"] = datetime.timedelta(minutes=11) + subscription_description_dict["lock_duration"] = datetime.timedelta(seconds=12) + subscription_description_dict["max_delivery_count"] = 14 + # topic_description.enable_partitioning = True # Cannot be changed after creation + # topic_description.requires_session = True # Cannot be changed after creation + + mgmt_service.update_subscription(topic_description.name, subscription_description_dict) + subscription_description = mgmt_service.get_subscription(topic_description.name, subscription_name) + + assert subscription_description.auto_delete_on_idle == datetime.timedelta(minutes=10) + assert subscription_description.dead_lettering_on_message_expiration == True + assert subscription_description.default_message_time_to_live == datetime.timedelta(minutes=11) + assert subscription_description.max_delivery_count == 14 + assert subscription_description.lock_duration == datetime.timedelta(seconds=12) + # assert topic_description.enable_partitioning == True + # assert topic_description.requires_session == True + + # Finally, test forward_to (separately, as it changes auto_delete_on_idle when you enable it.) + subscription_description_dict = dict(subscription_description) + subscription_description_dict["forward_to"] = "sb://{}.servicebus.windows.net/{}".format(servicebus_namespace.name, topic_name) + subscription_description_dict["forward_dead_lettered_messages_to"] = "sb://{}.servicebus.windows.net/{}".format(servicebus_namespace.name, topic_name) + mgmt_service.update_subscription(topic_description.name, subscription_description_dict) + subscription_description = mgmt_service.get_subscription(topic_description.name, subscription_name) + # Note: We endswith to avoid the fact that the servicebus_namespace_name is replacered locally but not in the properties bag, and still test this. + assert subscription_description.forward_to.endswith(".servicebus.windows.net/{}".format(topic_name)) + assert subscription_description.forward_dead_lettered_messages_to.endswith(".servicebus.windows.net/{}".format(topic_name)) + + finally: + mgmt_service.delete_subscription(topic_name, subscription_name) + mgmt_service.delete_topic(topic_name) + + @CachedResourceGroupPreparer(name_prefix='servicebustest') + @CachedServiceBusNamespacePreparer(name_prefix='servicebustest') + def test_mgmt_subscription_update_dict_error(self, servicebus_namespace_connection_string, **kwargs): + mgmt_service = ServiceBusAdministrationClient.from_connection_string(servicebus_namespace_connection_string) + clear_topics(mgmt_service) + topic_name = "dfjdfj" + subscription_name = "kwqxd" + + try: + topic_description = mgmt_service.create_topic(topic_name) + subscription_description = mgmt_service.create_subscription(topic_description.name, subscription_name) + # send in subscription dict without non-name keyword args + subscription_description_only_name = {"name": topic_name} + with pytest.raises(TypeError): + mgmt_service.update_subscription(topic_description.name, subscription_description_only_name) + finally: + mgmt_service.delete_subscription(topic_name, subscription_name) + mgmt_service.delete_topic(topic_name) diff --git a/sdk/servicebus/azure-servicebus/tests/mgmt_tests/test_mgmt_topics.py b/sdk/servicebus/azure-servicebus/tests/mgmt_tests/test_mgmt_topics.py index 99495a94c4d3..292c31a6ff0a 100644 --- a/sdk/servicebus/azure-servicebus/tests/mgmt_tests/test_mgmt_topics.py +++ b/sdk/servicebus/azure-servicebus/tests/mgmt_tests/test_mgmt_topics.py @@ -259,3 +259,64 @@ def test_mgmt_topic_get_runtime_properties_basic(self, servicebus_namespace_conn def test_topic_properties_constructor(self): with pytest.raises(TypeError): TopicProperties("randomname") + + @CachedResourceGroupPreparer(name_prefix='servicebustest') + @CachedServiceBusNamespacePreparer(name_prefix='servicebustest') + def test_mgmt_topic_update_dict_success(self, servicebus_namespace_connection_string, **kwargs): + mgmt_service = ServiceBusAdministrationClient.from_connection_string(servicebus_namespace_connection_string) + clear_topics(mgmt_service) + topic_name = "fjruid" + + try: + topic_description = mgmt_service.create_topic(topic_name) + topic_description_dict = dict(topic_description) + + # Try updating one setting. + topic_description_dict["default_message_time_to_live"] = datetime.timedelta(minutes=2) + mgmt_service.update_topic(topic_description_dict) + topic_description = mgmt_service.get_topic(topic_name) + assert topic_description.default_message_time_to_live == datetime.timedelta(minutes=2) + + # Now try updating all settings. + topic_description_dict = dict(topic_description) + topic_description_dict["auto_delete_on_idle"] = datetime.timedelta(minutes=10) + topic_description_dict["default_message_time_to_live"] = datetime.timedelta(minutes=11) + topic_description_dict["duplicate_detection_history_time_window"] = datetime.timedelta(minutes=12) + topic_description_dict["enable_batched_operations"] = True + topic_description_dict["enable_express"] = True + # topic_description_dict["enable_partitioning"] = True # Cannot be changed after creation + topic_description_dict["max_size_in_megabytes"] = 3072 + # topic_description_dict["requires_duplicate_detection"] = True # Read only + # topic_description_dict["requires_session"] = True # Cannot be changed after creation + topic_description_dict["support_ordering"] = True + + mgmt_service.update_topic(topic_description_dict) + topic_description = mgmt_service.get_topic(topic_name) + + assert topic_description.auto_delete_on_idle == datetime.timedelta(minutes=10) + assert topic_description.default_message_time_to_live == datetime.timedelta(minutes=11) + assert topic_description.duplicate_detection_history_time_window == datetime.timedelta(minutes=12) + assert topic_description.enable_batched_operations == True + assert topic_description.enable_express == True + # assert topic_description.enable_partitioning == True + assert topic_description.max_size_in_megabytes == 3072 + # assert topic_description.requires_duplicate_detection == True + # assert topic_description.requires_session == True + assert topic_description.support_ordering == True + finally: + mgmt_service.delete_topic(topic_name) + + @CachedResourceGroupPreparer(name_prefix='servicebustest') + @CachedServiceBusNamespacePreparer(name_prefix='servicebustest') + def test_mgmt_topic_update_dict_error(self, servicebus_namespace_connection_string, **kwargs): + mgmt_service = ServiceBusAdministrationClient.from_connection_string(servicebus_namespace_connection_string) + clear_topics(mgmt_service) + topic_name = "dfjdfj" + try: + topic_description = mgmt_service.create_topic(topic_name) + # send in topic dict without non-name keyword args + topic_description_only_name = {"name": topic_name} + with pytest.raises(TypeError): + mgmt_service.update_topic(topic_description_only_name) + finally: + mgmt_service.delete_topic(topic_name) diff --git a/sdk/servicebus/azure-servicebus/tests/test_queues.py b/sdk/servicebus/azure-servicebus/tests/test_queues.py index 5229dd26c0f2..820a63de50ba 100644 --- a/sdk/servicebus/azure-servicebus/tests/test_queues.py +++ b/sdk/servicebus/azure-servicebus/tests/test_queues.py @@ -41,8 +41,7 @@ MessageAlreadySettled, AutoLockRenewTimeout, MessageSizeExceededError, - OperationTimeoutError, - ServiceBusError + OperationTimeoutError ) from devtools_testutils import AzureMgmtTestCase, CachedResourceGroupPreparer @@ -2183,3 +2182,148 @@ def test_queue_by_servicebus_client_enum_case_sensitivity(self, servicebus_names sub_queue=str.upper(ServiceBusSubQueue.DEAD_LETTER.value), max_wait_time=5) as receiver: raise Exception("Should not get here, should be case sensitive.") + + @pytest.mark.liveTest + @pytest.mark.live_test_only + @CachedResourceGroupPreparer(name_prefix='servicebustest') + @CachedServiceBusNamespacePreparer(name_prefix='servicebustest') + @ServiceBusQueuePreparer(name_prefix='servicebustest') + def test_queue_send_dict_messages(self, servicebus_namespace_connection_string, servicebus_queue, **kwargs): + with ServiceBusClient.from_connection_string( + servicebus_namespace_connection_string, logging_enable=False) as sb_client: + + with sb_client.get_queue_sender(servicebus_queue.name) as sender: + + message_dict = {"body": "Message"} + message2_dict = {"body": "Message2"} + list_message_dicts = [message_dict, message2_dict] + + # send single dict + sender.send_messages(message_dict) + + # send list of dicts + sender.send_messages(list_message_dicts) + + # create and send BatchMessage with dicts + batch_message = sender.create_message_batch() + batch_message._from_list(list_message_dicts) # pylint: disable=protected-access + batch_message.add_message(message_dict) + sender.send_messages(batch_message) + + received_messages = [] + with sb_client.get_queue_receiver(servicebus_queue.name, max_wait_time=5) as receiver: + for message in receiver: + received_messages.append(message) + assert len(received_messages) == 6 + + @pytest.mark.liveTest + @pytest.mark.live_test_only + @CachedResourceGroupPreparer(name_prefix='servicebustest') + @CachedServiceBusNamespacePreparer(name_prefix='servicebustest') + @ServiceBusQueuePreparer(name_prefix='servicebustest') + def test_queue_send_dict_messages_error_badly_formatted_dicts(self, servicebus_namespace_connection_string, servicebus_queue, **kwargs): + with ServiceBusClient.from_connection_string( + servicebus_namespace_connection_string, logging_enable=False) as sb_client: + + with sb_client.get_queue_sender(servicebus_queue.name) as sender: + + message_dict = {"bad_key": "Message"} + message2_dict = {"bad_key": "Message2"} + list_message_dicts = [message_dict, message2_dict] + + # send single dict + with pytest.raises(TypeError): + sender.send_messages(message_dict) + + # send list of dicts + with pytest.raises(TypeError): + sender.send_messages(list_message_dicts) + + # create and send BatchMessage with dicts + batch_message = sender.create_message_batch() + with pytest.raises(TypeError): + batch_message._from_list(list_message_dicts) # pylint: disable=protected-access + + @pytest.mark.liveTest + @pytest.mark.live_test_only + @CachedResourceGroupPreparer(name_prefix='servicebustest') + @CachedServiceBusNamespacePreparer(name_prefix='servicebustest') + @ServiceBusQueuePreparer(name_prefix='servicebustest', dead_lettering_on_message_expiration=True) + def test_queue_send_dict_messages_scheduled(self, servicebus_namespace_connection_string, servicebus_queue, **kwargs): + + with ServiceBusClient.from_connection_string( + servicebus_namespace_connection_string, logging_enable=False) as sb_client: + content = "Test scheduled message" + message_id = uuid.uuid4() + message_id2 = uuid.uuid4() + scheduled_enqueue_time = (utc_now() + timedelta(minutes=0.05)).replace(microsecond=0) + message_dict = {"message_id": message_id, "body": content} + message2_dict = {"message_id": message_id2, "body": content} + list_message_dicts = [message_dict, message2_dict] + + # send single dict + with sb_client.get_queue_receiver(servicebus_queue.name) as receiver: + with sb_client.get_queue_sender(servicebus_queue.name) as sender: + tokens = sender.schedule_messages(message_dict, scheduled_enqueue_time) + assert len(tokens) == 1 + + messages = receiver.receive_messages(max_wait_time=20) + if messages: + try: + data = str(messages[0]) + assert data == content + assert messages[0].message_id == message_id + assert messages[0].scheduled_enqueue_time_utc == scheduled_enqueue_time + assert messages[0].scheduled_enqueue_time_utc <= messages[0].enqueued_time_utc.replace(microsecond=0) + assert len(messages) == 1 + finally: + for m in messages: + receiver.complete_message(m) + else: + raise Exception("Failed to receive schdeduled message.") + + # send list of dicts + with sb_client.get_queue_receiver(servicebus_queue.name, prefetch_count=20) as receiver: + with sb_client.get_queue_sender(servicebus_queue.name) as sender: + tokens = sender.schedule_messages(list_message_dicts, scheduled_enqueue_time) + assert len(tokens) == 2 + + messages = receiver.receive_messages(max_wait_time=20) + messages.extend(receiver.receive_messages(max_wait_time=5)) + if messages: + try: + data = str(messages[0]) + print(messages) + assert data == content + assert messages[0].message_id == message_id + assert messages[0].scheduled_enqueue_time_utc == scheduled_enqueue_time + assert messages[0].scheduled_enqueue_time_utc <= messages[0].enqueued_time_utc.replace(microsecond=0) + assert len(messages) == 2 + finally: + for m in messages: + receiver.complete_message(m) + else: + raise Exception("Failed to receive schdeduled message.") + + @pytest.mark.liveTest + @pytest.mark.live_test_only + @CachedResourceGroupPreparer(name_prefix='servicebustest') + @CachedServiceBusNamespacePreparer(name_prefix='servicebustest') + @ServiceBusQueuePreparer(name_prefix='servicebustest', dead_lettering_on_message_expiration=True) + def test_queue_send_dict_messages_scheduled_error_badly_formatted_dicts(self, servicebus_namespace_connection_string, servicebus_queue, **kwargs): + + with ServiceBusClient.from_connection_string( + servicebus_namespace_connection_string, logging_enable=False) as sb_client: + content = "Test scheduled message" + message_id = uuid.uuid4() + message_id2 = uuid.uuid4() + scheduled_enqueue_time = (utc_now() + timedelta(minutes=0.1)).replace(microsecond=0) + with sb_client.get_queue_receiver(servicebus_queue.name) as receiver: + with sb_client.get_queue_sender(servicebus_queue.name) as sender: + message_dict = {"message_id": message_id, "bad_key": content} + message2_dict = {"message_id": message_id2, "bad_key": content} + list_message_dicts = [message_dict, message2_dict] + with pytest.raises(TypeError): + sender.schedule_messages(message_dict, scheduled_enqueue_time) + with pytest.raises(TypeError): + sender.schedule_messages(list_message_dicts, scheduled_enqueue_time) \ No newline at end of file