def test_handle_request_does_not_authorize_bad_credentials(self): request = DummyRequest('/logtail/process1', None, None, None) encoded = base64.b64encode("wrong:wrong") request.header = ["Authorization: Basic %s" % encoded] handler = DummyHandler() auth_handler = self._makeOne({'user': '******'}, handler) auth_handler.handle_request(request) self.assertFalse(handler.handled_request)
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': '******'}, handler) auth_handler.handle_request(request) self.assertTrue(handler.handled_request)