本文整理汇总了Python中supervisor.tests.base.DummyRequest.header方法的典型用法代码示例。如果您正苦于以下问题:Python DummyRequest.header方法的具体用法?Python DummyRequest.header怎么用?Python DummyRequest.header使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类supervisor.tests.base.DummyRequest
的用法示例。
在下文中一共展示了DummyRequest.header方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_handle_request_does_not_authorize_bad_credentials
# 需要导入模块: from supervisor.tests.base import DummyRequest [as 别名]
# 或者: from supervisor.tests.base.DummyRequest import header [as 别名]
def test_handle_request_does_not_authorize_bad_credentials(self):
request = DummyRequest('/logtail/process1', None, None, None)
encoded = base64.b64encode(as_bytes("wrong:wrong"))
request.header = ["Authorization: Basic %s" % as_string(encoded)]
handler = DummyHandler()
auth_handler = self._makeOne({'user':'password'}, handler)
auth_handler.handle_request(request)
self.assertFalse(handler.handled_request)
示例2: test_handle_request_authorizes_good_password_with_colon
# 需要导入模块: from supervisor.tests.base import DummyRequest [as 别名]
# 或者: from supervisor.tests.base.DummyRequest import header [as 别名]
def test_handle_request_authorizes_good_password_with_colon(self):
request = DummyRequest('/logtail/process1', None, None, None)
encoded = base64.b64encode("user:pass:word") # password contains colon
request.header = ["Authorization: Basic %s" % encoded]
handler = DummyHandler()
auth_handler = self._makeOne({'user':'pass:word'}, handler)
auth_handler.handle_request(request)
self.assertTrue(handler.handled_request)