def test_loginWithoutPortal(self):
        """
        Attempting to log into a server that has no L{Portal} results
        in a failed login.
        """
        self.server.portal = None
        def login():
            d = self.client.login(b'testuser', b'wrong-password')
            d.addBoth(self._cbStopClient)

        d1 = self.connected.addCallback(strip(login)).addErrback(self._ebGeneral)
        d2 = self.loopback()
        d = defer.gatherResults([d1, d2])
        return d.addCallback(self._cbTestFailedLogin)

        Attempting to log into a server that has no L{Portal} results
        in a failed login.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/mail/test/test_imap.py