def test_missingPortal(self):
        """
        An L{imap4.IMAP4Server} that is missing a L{Portal} responds
        negatively to an authentication
        """
        self.server.challengers[b'LOGIN'] = imap4.LOGINCredentials

        cAuth = imap4.LOGINAuthenticator(b'testuser')
        self.client.registerAuthenticator(cAuth)

        self.server.portal = None

        def auth():
            return self.client.authenticate(b'secret')

        d = self.connected.addCallback(strip(auth))
        d.addErrback(self.assertClientFailureMessage,
                     b"Temporary authentication failure")
        d.addCallbacks(self._cbStopClient, self._ebGeneral)

        return defer.gatherResults([d, self.loopback()])

        An L{imap4.IMAP4Server} that is missing a L{Portal} responds
        negatively to an authentication
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/mail/test/test_imap.py