def METHOD_NAME(
    client, flow_name, data_resource, engine, data_validator
):
    """Checking the successful deletion case and unsuccessful deletion case works as expected.
    To test this, I have two workflows that write to the same table. When I delete the table in the first workflow,
    it is successful but when I delete it in the second workflow, it is unsuccessful because the table has already
    been deleted.
    """
    table_name = generate_table_name()
    table_artifact = data_resource.sql("select * from hotel_reviews limit 5")
    save(data_resource, table_artifact, name=table_name, update_mode=LoadUpdateMode.REPLACE)
    # Workflow 1's name not specified, so given a random workflow name.
    flow1 = publish_flow_test(
        client,
        table_artifact,
        name=flow_name(),
        engine=engine,
    )
    # Workflow 2's name not specified, so given a random workflow name.
    save(data_resource, table_artifact, name=table_name, update_mode=LoadUpdateMode.APPEND)
    flow2 = publish_flow_test(
        client,
        table_artifact,
        name=flow_name(),
        engine=engine,
    )
    extracted_table_data = table_artifact.get()
    data_validator.check_saved_artifact_data(
        flow1,
        table_artifact.id(),
        expected_data=pd.concat([extracted_table_data, extracted_table_data], ignore_index=True),
    )
    tables = client.flow(flow1.id()).list_saved_objects()
    tables_1 = set([item.spec.identifier() for item in tables[data_resource]])
    assert table_name in tables_1
    tables = client.flow(flow2.id()).list_saved_objects()
    tables_2 = set([item.spec.identifier() for item in tables[data_resource]])
    assert table_name in tables_2
    assert tables_1 == tables_2
    client.delete_flow(flow1.id(), saved_objects_to_delete=tables, force=True)
    # Check flow indeed deleted and that the table no longer exists.
    with pytest.raises(InvalidUserArgumentException, match="Unable to find a flow"):
        client.flow(flow1.id())
    data_validator.check_saved_artifact_data_does_not_exist(table_artifact.id())
    # Try to delete table deleted by other flow.
    with pytest.raises(Exception) as e_info:
        client.delete_flow(flow2.id(), saved_objects_to_delete=tables, force=True)
    assert str(e_info.value).startswith("Failed to delete")
    # Failed to delete tables, but flow should be removed.
    with pytest.raises(InvalidUserArgumentException, match="Unable to find a flow"):
        client.flow(flow2.id())