本文整理汇总了Python中azure.servicebus.ServiceBusService.delete_rule方法的典型用法代码示例。如果您正苦于以下问题:Python ServiceBusService.delete_rule方法的具体用法?Python ServiceBusService.delete_rule怎么用?Python ServiceBusService.delete_rule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类azure.servicebus.ServiceBusService
的用法示例。
在下文中一共展示了ServiceBusService.delete_rule方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ServiceBusTest
# 需要导入模块: from azure.servicebus import ServiceBusService [as 别名]
# 或者: from azure.servicebus.ServiceBusService import delete_rule [as 别名]
#.........这里部分代码省略.........
# Act
with self.assertRaises(WindowsAzureError):
self.sbs.get_rule(self.topic_name,
'MySubscription', 'NonExistingRule')
# Assert
def test_get_rule_with_existing_rule_with_options(self):
# Arrange
self._create_topic_and_subscription(self.topic_name, 'MySubscription')
sent_rule = Rule()
sent_rule.filter_type = 'SqlFilter'
sent_rule.filter_expression = 'foo > 40'
sent_rule.action_type = 'SqlRuleAction'
sent_rule.action_expression = 'SET foo = 5'
self.sbs.create_rule(
self.topic_name, 'MySubscription', 'MyRule1', sent_rule)
# Act
received_rule = self.sbs.get_rule(
self.topic_name, 'MySubscription', 'MyRule1')
# Assert
self.assertIsNotNone(received_rule)
self.assertEquals(received_rule.name, 'MyRule1')
self.assertEquals(received_rule.filter_type, sent_rule.filter_type)
self.assertEquals(received_rule.filter_expression,
sent_rule.filter_expression)
self.assertEquals(received_rule.action_type, sent_rule.action_type)
self.assertEquals(received_rule.action_expression,
sent_rule.action_expression)
def test_delete_rule_with_existing_rule(self):
# Arrange
self._create_topic_and_subscription(self.topic_name, 'MySubscription')
resp = self.sbs.create_rule(
self.topic_name, 'MySubscription', 'MyRule3')
resp = self.sbs.create_rule(
self.topic_name, 'MySubscription', 'MyRule4')
# Act
deleted1 = self.sbs.delete_rule(
self.topic_name, 'MySubscription', 'MyRule4')
deleted2 = self.sbs.delete_rule(
self.topic_name, 'MySubscription', '$Default')
# Assert
self.assertTrue(deleted1)
self.assertTrue(deleted2)
rules = self.sbs.list_rules(self.topic_name, 'MySubscription')
self.assertIsNotNone(rules)
self.assertEquals(len(rules), 1)
self.assertEquals(rules[0].name, 'MyRule3')
def test_delete_rule_with_existing_rule_fail_not_exist(self):
# Arrange
self._create_topic_and_subscription(self.topic_name, 'MySubscription')
resp = self.sbs.create_rule(
self.topic_name, 'MySubscription', 'MyRule3')
resp = self.sbs.create_rule(
self.topic_name, 'MySubscription', 'MyRule4')
# Act
deleted1 = self.sbs.delete_rule(
self.topic_name, 'MySubscription', 'MyRule4', True)