本文整理汇总了Python中supervisor.tests.base.DummyRequest类的典型用法代码示例。如果您正苦于以下问题:Python DummyRequest类的具体用法?Python DummyRequest怎么用?Python DummyRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DummyRequest类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_handle_request_does_not_authorize_bad_credentials
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
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)