def test_anonymousLoginNotPermitted(self):
        """
        Verify that without an anonymous checker set up, anonymous login is
        rejected.
        """
        self.portal.registerChecker(
            checkers.InMemoryUsernamePasswordDatabaseDontUse(user='pass'))
        d = self.clientFactory.login(credentials.Anonymous(), "BRAINS!")
        self.assertFailure(d, UnhandledCredentials)

        def cleanup(ignore):
            errors = self.flushLoggedErrors(UnhandledCredentials)
            self.assertEqual(len(errors), 1)
        d.addCallback(cleanup)

        self.establishClientAndServer()
        self.pump.flush()

        return d

        Verify that without an anonymous checker set up, anonymous login is
        rejected.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/spread/test/test_pb.py