  def testCreateInstanceFromRequest(
      self, mock_gce_api, mock_block_operation):
    """Test creating compute instance via providing arguments."""
    instances = mock_gce_api.return_value.instances
    mock_insert = instances.return_value.insert
    mock_insert.return_value.execute.return_value = {
        'name': gcp_mocks.FAKE_INSTANCE.name}
    mock_block_operation.return_value = None

    instance = gcp_mocks.FAKE_ANALYSIS_PROJECT.compute.CreateInstanceFromRequest(
        {'name': gcp_mocks.FAKE_INSTANCE.name}, 'us-central1-a')

    self.assertIsInstance(instance, compute.GoogleComputeInstance)
    self.assertEqual(gcp_mocks.FAKE_INSTANCE.name, instance.name)
    mock_insert.return_value.execute.assert_called()
Test creating compute instance via providing arguments.
tests/providers/gcp/internal/test_compute.py