  def testGetInstance(self, mock_list_instances):
    """Test that an instance of a project can be found."""
    mock_list_instances.return_value = gcp_mocks.MOCK_LIST_INSTANCES
    found_instance = gcp_mocks.FAKE_SOURCE_PROJECT.compute.GetInstance(gcp_mocks.FAKE_INSTANCE.name)
    self.assertIsInstance(found_instance, compute.GoogleComputeInstance)
    self.assertEqual(gcp_mocks.FAKE_SOURCE_PROJECT.project_id, found_instance.project_id)
    self.assertEqual('fake-instance', found_instance.name)
    self.assertEqual('fake-zone', found_instance.zone)
    # pylint: disable=protected-access
    self.assertEqual(gcp_mocks.FAKE_INSTANCE._data, found_instance._data)
    # pylint: enable=protected-access
    with self.assertRaises(errors.ResourceNotFoundError):
      gcp_mocks.FAKE_SOURCE_PROJECT.compute.GetInstance('non-existent-instance')
    id_found_instance = gcp_mocks.FAKE_SOURCE_PROJECT.compute.GetInstance(gcp_mocks.FAKE_INSTANCE.resource_id)
    self.assertEqual(id_found_instance, gcp_mocks.FAKE_INSTANCE)
Test that an instance of a project can be found.
tests/providers/gcp/internal/test_compute.py