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.args[1].portal self.assertEquals( set(portal.checkers.keys()), set([IPluggableAuthenticationModules, ISSHPrivateKey, IUsernamePassword]))