  def testBlockOperation(self, mock_gcb_api):
    """Test that Cloud Builds are correctly blocked until done."""
    build_operation_object = mock_gcb_api.return_value.operations.return_value.get
    build_operation_object.return_value.execute.return_value = gcp_mocks.MOCK_GCB_BUILDS_SUCCESS
    block_build_success = gcp_mocks.FAKE_GCB.BlockOperation(
        gcp_mocks.MOCK_GCB_BUILDS_CREATE)
    self.assertEqual(gcp_mocks.MOCK_GCB_BUILDS_SUCCESS, block_build_success)
    build_operation_object.return_value.execute.return_value = gcp_mocks.MOCK_GCB_BUILDS_FAIL
    with self.assertRaises(RuntimeError):
      gcp_mocks.FAKE_GCB.BlockOperation(gcp_mocks.MOCK_GCB_BUILDS_CREATE)
Test that Cloud Builds are correctly blocked until done.
tests/providers/gcp/internal/test_build.py