def test_basic(self): """ L{tap.makeService} returns a L{StreamServerEndpointService} instance running on TCP port 22, and the linked protocol factory is an instance of L{OpenSSHFactory}. """ config = tap.Options() service = tap.makeService(config) self.assertIsInstance(service, StreamServerEndpointService) self.assertEquals(service.endpoint._port, 22) self.assertIsInstance(service.factory, OpenSSHFactory)
def test_basic(self): """ L{tap.makeService} returns a L{TCPServer} instance running on port 22, and the linked protocol factory is an instance of L{OpenSSHFactory}. """ config = tap.Options() service = tap.makeService(config) self.assertIsInstance(service, TCPServer) self.assertEquals(service.args[0], 22) factory = service.args[1] self.assertIsInstance(factory, OpenSSHFactory)
def test_basic(self): """ L{tap.makeService} returns a L{StreamServerEndpointService} instance running on TCP port 22, and the linked protocol factory is an instance of L{OpenSSHFactory}. """ config = tap.Options() service = tap.makeService(config) self.assertIsInstance(service, StreamServerEndpointService) self.assertEqual(service.endpoint._port, 22) self.assertIsInstance(service.factory, OpenSSHFactory)
def test_checkers(self): """ The L{OpenSSHFactory} built by L{tap.makeService} has a portal with L{ISSHPrivateKey} and L{IUsernamePassword} interfaces registered as checkers. """ config = tap.Options() service = tap.makeService(config) portal = service.factory.portal self.assertEqual(set(portal.checkers.keys()), set([ISSHPrivateKey, IUsernamePassword]))
def test_checkers(self): """ The L{OpenSSHFactory} built by L{tap.makeService} has a portal with L{ISSHPrivateKey} and L{IUsernamePassword} interfaces registered as checkers. """ config = tap.Options() service = tap.makeService(config) portal = service.factory.portal self.assertEqual( set(portal.checkers.keys()), set([ISSHPrivateKey, IUsernamePassword]))
def test_checkersWithoutPamAuth(self): """ The L{OpenSSHFactory} built by L{tap.makeService} has a portal with L{ISSHPrivateKey} and L{IUsernamePassword} interfaces registered as checkers if C{pamauth} is not available. """ # Fake the absence of pamauth, even if PyPAM is installed self.patch(tap, "pamauth", None) config = tap.Options() service = tap.makeService(config) portal = service.factory.portal self.assertEquals(set(portal.checkers.keys()), set([ISSHPrivateKey, IUsernamePassword]))
def test_checkersPamAuth(self): """ The L{OpenSSHFactory} built by L{tap.makeService} has a portal with L{IPluggableAuthenticationModules}, L{ISSHPrivateKey} and L{IUsernamePassword} interfaces registered as checkers if C{pamauth} is available. """ # Fake the presence of pamauth, even if PyPAM is not installed self.patch(tap, "pamauth", object()) config = tap.Options() service = tap.makeService(config) portal = service.factory.portal self.assertEqual( set(portal.checkers.keys()), set([IPluggableAuthenticationModules, ISSHPrivateKey, IUsernamePassword]))
def test_checkersPamAuth(self): """ The L{OpenSSHFactory} built by L{tap.makeService} has a portal with L{IPluggableAuthenticationModules}, L{ISSHPrivateKey} and L{IUsernamePassword} interfaces registered as checkers if C{pamauth} is available. """ # Fake the presence of pamauth, even if PyPAM is not installed self.patch(tap, "pamauth", object()) config = tap.Options() service = tap.makeService(config) portal = service.args[1].portal self.assertEquals( set(portal.checkers.keys()), set([IPluggableAuthenticationModules, ISSHPrivateKey, IUsernamePassword]))