'If the L{SSHUserAuthServer} is not advertising passwords, then an
unencrypted connection should not cause any warnings or exceptions.
This is a white box test.'

def test_unencryptedConnectionWithoutPasswords(self):

    portal = Portal(self.realm)
    portal.registerChecker(PrivateKeyChecker())
    clearAuthServer = userauth.SSHUserAuthServer()
    clearAuthServer.transport = FakeTransport(portal)
    clearAuthServer.transport.isEncrypted = (lambda x: False)
    clearAuthServer.serviceStarted()
    clearAuthServer.serviceStopped()
    self.assertEqual(clearAuthServer.supportedAuthentications, ['publickey'])
    halfAuthServer = userauth.SSHUserAuthServer()
    halfAuthServer.transport = FakeTransport(portal)
    halfAuthServer.transport.isEncrypted = (lambda x: (x == 'in'))
    halfAuthServer.serviceStarted()
    halfAuthServer.serviceStopped()
    self.assertEqual(clearAuthServer.supportedAuthentications, ['publickey'])
