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


Python DummyRequest.environ方法代码示例

本文整理汇总了Python中pyramid.testing.DummyRequest.environ方法的典型用法代码示例。如果您正苦于以下问题:Python DummyRequest.environ方法的具体用法?Python DummyRequest.environ怎么用?Python DummyRequest.environ使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyramid.testing.DummyRequest的用法示例。


在下文中一共展示了DummyRequest.environ方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_build_url_forward_headers

# 需要导入模块: from pyramid.testing import DummyRequest [as 别名]
# 或者: from pyramid.testing.DummyRequest import environ [as 别名]
 def test_build_url_forward_headers(self):
     request = DummyRequest()
     request.environ = {
         "SERVER_NAME": "example.com"
     }
     request.registry.settings = {
         "checker": {
             "forward_headers": ["Cookie"]
         }
     }
     request.headers["Cookie"] = "test"
     self.assertEqual(
         build_url(
             "Test",
             "https://camptocamp.com/toto?titi#tutu",
             request
         ),
         (
             "https://camptocamp.com/toto?titi#tutu",
             {
                 "Cache-Control": "no-cache",
                 "Cookie": "test",
             }
         )
     )
开发者ID:craxxkid,项目名称:c2cgeoportal,代码行数:27,代码来源:test_checker.py

示例2: get_session_id

# 需要导入模块: from pyramid.testing import DummyRequest [as 别名]
# 或者: from pyramid.testing.DummyRequest import environ [as 别名]
 def get_session_id(self, cookie_name, cookie_value):
     # create dummy request
     request = DummyRequest()
     request.environ = {'HTTP_HOST': 'localhost'}
     request.cookies[cookie_name] = cookie_value
     # create authentication policy
     setting_prefix = 'auth.policy.'
     options = dict((key[len(setting_prefix):], TestPdfSession.settings[key]) for key in TestPdfSession.settings if key.startswith(setting_prefix))
     policy = EdAuthAuthenticationPolicy(**options)
     # get session id
     session_id = policy.unauthenticated_userid(request)
     return session_id
开发者ID:SmarterApp,项目名称:RDW_DataWarehouse,代码行数:14,代码来源:test_batch_user_session.py

示例3: _create_dummy_request

# 需要导入模块: from pyramid.testing import DummyRequest [as 别名]
# 或者: from pyramid.testing.DummyRequest import environ [as 别名]
 def _create_dummy_request():
     request = DummyRequest()
     request.environ = {"SERVER_NAME": "example.com"}
     return request
开发者ID:camptocamp,项目名称:c2cgeoportal,代码行数:6,代码来源:test_checker.py


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