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