Пример #1
0
 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)
Пример #2
0
 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)
Пример #3
0
 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)
Пример #4
0
 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]))
Пример #5
0
 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]))
Пример #6
0
 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]))
Пример #7
0
 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]))
Пример #8
0
 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]))
Пример #9
0
 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]))