本文整理匯總了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)