def test_basicAuthException(self):
        """
        A L{Request} that throws an exception processing basic authorization
        logs an error and uses an empty username and password.
        """
        logObserver = EventLoggingObserver.createWithCleanup(
            self,
            globalLogPublisher
        )
        requests = []
        class Request(http.Request):
            def process(self):
                self.credentials = (self.getUser(), self.getPassword())
                requests.append(self)

        u = b"foo"
        p = b"bar"
        s = base64.encodestring(b":".join((u, p))).strip()
        f = b"GET / HTTP/1.0\nAuthorization: Basic " + s + b"\n\n"
        self.patch(base64, 'decodestring', lambda x: [])
        self.runRequest(f, Request, 0)
        req = requests.pop()
        self.assertEqual(('', ''), req.credentials)
        self.assertEquals(1, len(logObserver))
        event = logObserver[0]
        f = event["log_failure"]
        self.assertIsInstance(f.value, AttributeError)
        self.flushLoggedErrors(AttributeError)

        A L{Request} that throws an exception processing basic authorization
        logs an error and uses an empty username and password.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/web/test/test_http.py