'Test that the userauth service does not advertise password
authentication if the password would be send in cleartext.'

def test_removePasswordIfUnencrypted(self):

    self.assertIn('password', self.authServer.supportedAuthentications)
    clearAuthServer = userauth.SSHUserAuthServer()
    clearAuthServer.transport = FakeTransport(self.portal)
    clearAuthServer.transport.isEncrypted = (lambda x: False)
    clearAuthServer.serviceStarted()
    clearAuthServer.serviceStopped()
    self.assertNotIn('password', clearAuthServer.supportedAuthentications)
    halfAuthServer = userauth.SSHUserAuthServer()
    halfAuthServer.transport = FakeTransport(self.portal)
    halfAuthServer.transport.isEncrypted = (lambda x: (x == 'in'))
    halfAuthServer.serviceStarted()
    halfAuthServer.serviceStopped()
    self.assertIn('password', halfAuthServer.supportedAuthentications)
