当前位置: 首页>>代码示例>>Python>>正文


Python Zappa.selection_pattern方法代码示例

本文整理汇总了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)
开发者ID:ConfidentCannabis,项目名称:Zappa,代码行数:14,代码来源:tests.py

示例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)
开发者ID:ConfidentCannabis,项目名称:Zappa,代码行数:17,代码来源:tests.py

示例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, '')
开发者ID:ConfidentCannabis,项目名称:Zappa,代码行数:5,代码来源:tests.py


注:本文中的zappa.zappa.Zappa.selection_pattern方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。