本文整理汇总了Python中azure.servicebus.ServiceBusService.delete_subscription方法的典型用法代码示例。如果您正苦于以下问题:Python ServiceBusService.delete_subscription方法的具体用法?Python ServiceBusService.delete_subscription怎么用?Python ServiceBusService.delete_subscription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类azure.servicebus.ServiceBusService
的用法示例。
在下文中一共展示了ServiceBusService.delete_subscription方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ServiceBusTest
# 需要导入模块: from azure.servicebus import ServiceBusService [as 别名]
# 或者: from azure.servicebus.ServiceBusService import delete_subscription [as 别名]
#.........这里部分代码省略.........
# Arrange
self._create_topic_and_subscription(self.topic_name, 'MySubscription2')
# Act
subscriptions = self.sbs.list_subscriptions(self.topic_name)
# Assert
self.assertIsNotNone(subscriptions)
self.assertEquals(len(subscriptions), 1)
self.assertEquals(subscriptions[0].name, 'MySubscription2')
def test_get_subscription_with_existing_subscription(self):
# Arrange
self._create_topic_and_subscription(self.topic_name, 'MySubscription3')
# Act
subscription = self.sbs.get_subscription(
self.topic_name, 'MySubscription3')
# Assert
self.assertIsNotNone(subscription)
self.assertEquals(subscription.name, 'MySubscription3')
def test_get_subscription_with_non_existing_subscription(self):
# Arrange
self._create_topic_and_subscription(self.topic_name, 'MySubscription3')
# Act
with self.assertRaises(WindowsAzureError):
self.sbs.get_subscription(self.topic_name, 'MySubscription4')
# Assert
def test_delete_subscription_with_existing_subscription(self):
# Arrange
self._create_topic(self.topic_name)
self._create_subscription(self.topic_name, 'MySubscription4')
self._create_subscription(self.topic_name, 'MySubscription5')
# Act
deleted = self.sbs.delete_subscription(
self.topic_name, 'MySubscription4')
# Assert
self.assertTrue(deleted)
subscriptions = self.sbs.list_subscriptions(self.topic_name)
self.assertIsNotNone(subscriptions)
self.assertEquals(len(subscriptions), 1)
self.assertEquals(subscriptions[0].name, 'MySubscription5')
def test_delete_subscription_with_existing_subscription_fail_not_exist(self):
# Arrange
self._create_topic(self.topic_name)
self._create_subscription(self.topic_name, 'MySubscription4')
self._create_subscription(self.topic_name, 'MySubscription5')
# Act
deleted = self.sbs.delete_subscription(
self.topic_name, 'MySubscription4', True)
# Assert
self.assertTrue(deleted)
subscriptions = self.sbs.list_subscriptions(self.topic_name)
self.assertIsNotNone(subscriptions)
self.assertEquals(len(subscriptions), 1)
self.assertEquals(subscriptions[0].name, 'MySubscription5')