def testX509Verify(self):

    # This is a successful verify.
    with utils.Stubber(X509.X509, "verify", lambda self, pkey=None: 1):
      self.client_communicator.LoadServerCertificate(
          self.server_certificate, config_lib.CONFIG["CA.certificate"])

      # Mock the verify function to simulate certificate failures.
      X509.X509.verify = lambda self, pkey=None: 0
      self.assertRaises(
          IOError, self.client_communicator.LoadServerCertificate,
          self.server_certificate, config_lib.CONFIG["CA.certificate"])

      # Verification can also fail with a -1 error.
      X509.X509.verify = lambda self, pkey=None: -1
      self.assertRaises(
          IOError, self.client_communicator.LoadServerCertificate,
          self.server_certificate, config_lib.CONFIG["CA.certificate"])
Create an instance fault at the top level cell.
dataset/ETHPy150Open google/grr/grr/lib/communicator_test.py/ClientCommsTest.testX509Verify--crossover with--dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/cells/manager.py/CellsManager.instance_fault_create_at_top