本文整理汇总了Python中zappa.zappa.Zappa.selection_pattern方法的典型用法代码示例。如果您正苦于以下问题:Python Zappa.selection_pattern方法的具体用法?Python Zappa.selection_pattern怎么用?Python Zappa.selection_pattern使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zappa.zappa.Zappa
的用法示例。
在下文中一共展示了Zappa.selection_pattern方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_b64_pattern
# 需要导入模块: from zappa.zappa import Zappa [as 别名]
# 或者: from zappa.zappa.Zappa import selection_pattern [as 别名]
def test_b64_pattern(self):
head = '<!DOCTYPE html>'
for code in ['400', '401', '402', '403', '404', '500']:
pattern = Zappa.selection_pattern(code)
document = base64.b64encode(head + code + random_string(50))
self.assertRegexpMatches(document, pattern)
for bad_code in ['200', '301', '302']:
document = base64.b64encode(head + bad_code + random_string(50))
self.assertNotRegexpMatches(document, pattern)
示例2: test_redirect_pattern
# 需要导入模块: from zappa.zappa import Zappa [as 别名]
# 或者: from zappa.zappa.Zappa import selection_pattern [as 别名]
def test_redirect_pattern(self):
test_urls = [
# a regular endpoint url
'https://asdf1234.execute-api.us-east-1.amazonaws.com/env/path/to/thing',
# an external url (outside AWS)
'https://github.com/Miserlou/zappa/issues?q=is%3Aissue+is%3Aclosed',
# a local url
'/env/path/to/thing'
]
for code in ['301', '302']:
pattern = Zappa.selection_pattern(code)
for url in test_urls:
self.assertRegexpMatches(url, pattern)
示例3: test_200_pattern
# 需要导入模块: from zappa.zappa import Zappa [as 别名]
# 或者: from zappa.zappa.Zappa import selection_pattern [as 别名]
def test_200_pattern(self):
pattern = Zappa.selection_pattern('200')
self.assertEqual(pattern, '')