#!/usr/bin/env python3
"""
Auto-generated CLI tests for wf commands

Generated by: tests/generators/test_generator.py
DO NOT EDIT MANUALLY - Regenerate with: python tests/generators/test_generator.py

This file provides comprehensive coverage of wf CLI commands, options,
and parameter combinations. Tests are automatically generated by introspecting
the Click command structure.
"""

import subprocess
import os

# Set testing environment variable
os.environ["N8N_DEPLOY_TESTING"] = "1"

CLI_COMMAND = ["./n8n-deploy"]


def test_wf_add_help():
    """Test wf  add --help"""
    result = subprocess.run(CLI_COMMAND + ["wf", "add", "--help"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf add --help\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )
    assert "Usage:" in result.stdout or "Usage:" in result.stderr, (
        f"Expected 'Usage:' in output\n" f"stdout: {result.stdout[:500]}\n" f"stderr: {result.stderr[:500]}"
    )


def test_wf_add_data_dir_valid_path():
    """Test wf  add with valid --data-dir"""
    result = subprocess.run(CLI_COMMAND + ["wf", "add", "--data-dir", "/tmp"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0, 1, 2], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf add --data-dir /tmp\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )


def test_wf_add_output_json_flag():
    """Test wf  add with --output-json flag"""
    result = subprocess.run(CLI_COMMAND + ["wf", "add", "--output-json"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0, 1, 2], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf add --output-json\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )


def test_wf_add_with_positional_args():
    """Test wf  add with positional arguments"""
    result = subprocess.run(CLI_COMMAND + ["wf", "add", "test_workflow_file"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0, 1, 2], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf add test_workflow_file\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )


def test_wf_add_missing_required_args():
    """Test wf  add with missing required arguments"""
    result = subprocess.run(CLI_COMMAND + ["wf", "add"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [2], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf add\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )
    assert "Error:" in result.stdout or "Error:" in result.stderr, (
        f"Expected 'Error:' in output\n" f"stdout: {result.stdout[:500]}\n" f"stderr: {result.stderr[:500]}"
    )


def test_wf_delete_help():
    """Test wf  delete --help"""
    result = subprocess.run(CLI_COMMAND + ["wf", "delete", "--help"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf delete --help\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )
    assert "Usage:" in result.stdout or "Usage:" in result.stderr, (
        f"Expected 'Usage:' in output\n" f"stdout: {result.stdout[:500]}\n" f"stderr: {result.stderr[:500]}"
    )


def test_wf_delete_skip_ssl_verify_flag():
    """Test wf  delete with --skip-ssl-verify flag"""
    result = subprocess.run(CLI_COMMAND + ["wf", "delete", "--skip-ssl-verify"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0, 1, 2], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf delete --skip-ssl-verify\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )


def test_wf_delete_data_dir_valid_path():
    """Test wf  delete with valid --data-dir"""
    result = subprocess.run(CLI_COMMAND + ["wf", "delete", "--data-dir", "/tmp"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0, 1, 2], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf delete --data-dir /tmp\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )


def test_wf_delete_yes_flag():
    """Test wf  delete with --yes flag"""
    result = subprocess.run(CLI_COMMAND + ["wf", "delete", "--yes"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0, 1, 2], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf delete --yes\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )


def test_wf_delete_with_positional_args():
    """Test wf  delete with positional arguments"""
    result = subprocess.run(CLI_COMMAND + ["wf", "delete", "test_workflow_id"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0, 1, 2], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf delete test_workflow_id\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )


def test_wf_delete_missing_required_args():
    """Test wf  delete with missing required arguments"""
    result = subprocess.run(CLI_COMMAND + ["wf", "delete"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [2], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf delete\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )
    assert "Error:" in result.stdout or "Error:" in result.stderr, (
        f"Expected 'Error:' in output\n" f"stdout: {result.stdout[:500]}\n" f"stderr: {result.stderr[:500]}"
    )


def test_wf_link_help():
    """Test wf  link --help"""
    result = subprocess.run(CLI_COMMAND + ["wf", "link", "--help"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf link --help\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )
    assert "Usage:" in result.stdout or "Usage:" in result.stderr, (
        f"Expected 'Usage:' in output\n" f"stdout: {result.stdout[:500]}\n" f"stderr: {result.stderr[:500]}"
    )


def test_wf_link_data_dir_valid_path():
    """Test wf  link with valid --data-dir"""
    result = subprocess.run(CLI_COMMAND + ["wf", "link", "--data-dir", "/tmp"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0, 1, 2], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf link --data-dir /tmp\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )


def test_wf_link_output_json_flag():
    """Test wf  link with --output-json flag"""
    result = subprocess.run(CLI_COMMAND + ["wf", "link", "--output-json"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0, 1, 2], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf link --output-json\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )


def test_wf_link_with_positional_args():
    """Test wf  link with positional arguments"""
    result = subprocess.run(CLI_COMMAND + ["wf", "link", "test_workflow_id"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0, 1, 2], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf link test_workflow_id\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )


def test_wf_link_missing_required_args():
    """Test wf  link with missing required arguments"""
    result = subprocess.run(CLI_COMMAND + ["wf", "link"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [2], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf link\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )
    assert "Error:" in result.stdout or "Error:" in result.stderr, (
        f"Expected 'Error:' in output\n" f"stdout: {result.stdout[:500]}\n" f"stderr: {result.stderr[:500]}"
    )


def test_wf_list_help():
    """Test wf  list --help"""
    result = subprocess.run(CLI_COMMAND + ["wf", "list", "--help"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf list --help\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )
    assert "Usage:" in result.stdout or "Usage:" in result.stderr, (
        f"Expected 'Usage:' in output\n" f"stdout: {result.stdout[:500]}\n" f"stderr: {result.stderr[:500]}"
    )


def test_wf_list_no_args():
    """Test wf  list with no arguments"""
    result = subprocess.run(CLI_COMMAND + ["wf", "list"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0, 1], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf list\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )


def test_wf_list_data_dir_valid_path():
    """Test wf  list with valid --data-dir"""
    result = subprocess.run(CLI_COMMAND + ["wf", "list", "--data-dir", "/tmp"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0, 1, 2], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf list --data-dir /tmp\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )


def test_wf_list_output_json_flag():
    """Test wf  list with --output-json flag"""
    result = subprocess.run(CLI_COMMAND + ["wf", "list", "--output-json"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0, 1, 2], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf list --output-json\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )


def test_wf_list_output_table_flag():
    """Test wf  list with --output-table flag"""
    result = subprocess.run(CLI_COMMAND + ["wf", "list", "--output-table"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0, 1, 2], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf list --output-table\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )


def test_wf_pull_help():
    """Test wf  pull --help"""
    result = subprocess.run(CLI_COMMAND + ["wf", "pull", "--help"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf pull --help\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )
    assert "Usage:" in result.stdout or "Usage:" in result.stderr, (
        f"Expected 'Usage:' in output\n" f"stdout: {result.stdout[:500]}\n" f"stderr: {result.stderr[:500]}"
    )


def test_wf_pull_skip_ssl_verify_flag():
    """Test wf  pull with --skip-ssl-verify flag"""
    result = subprocess.run(CLI_COMMAND + ["wf", "pull", "--skip-ssl-verify"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0, 1, 2], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf pull --skip-ssl-verify\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )


def test_wf_pull_data_dir_valid_path():
    """Test wf  pull with valid --data-dir"""
    result = subprocess.run(CLI_COMMAND + ["wf", "pull", "--data-dir", "/tmp"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0, 1, 2], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf pull --data-dir /tmp\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )


def test_wf_pull_with_positional_args():
    """Test wf  pull with positional arguments"""
    result = subprocess.run(CLI_COMMAND + ["wf", "pull", "test_workflow_id"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0, 1, 2], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf pull test_workflow_id\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )


def test_wf_pull_missing_required_args():
    """Test wf  pull with missing required arguments"""
    result = subprocess.run(CLI_COMMAND + ["wf", "pull"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [2], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf pull\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )
    assert "Error:" in result.stdout or "Error:" in result.stderr, (
        f"Expected 'Error:' in output\n" f"stdout: {result.stdout[:500]}\n" f"stderr: {result.stderr[:500]}"
    )


def test_wf_push_help():
    """Test wf  push --help"""
    result = subprocess.run(CLI_COMMAND + ["wf", "push", "--help"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf push --help\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )
    assert "Usage:" in result.stdout or "Usage:" in result.stderr, (
        f"Expected 'Usage:' in output\n" f"stdout: {result.stdout[:500]}\n" f"stderr: {result.stderr[:500]}"
    )


def test_wf_push_skip_ssl_verify_flag():
    """Test wf  push with --skip-ssl-verify flag"""
    result = subprocess.run(CLI_COMMAND + ["wf", "push", "--skip-ssl-verify"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0, 1, 2], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf push --skip-ssl-verify\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )


def test_wf_push_data_dir_valid_path():
    """Test wf  push with valid --data-dir"""
    result = subprocess.run(CLI_COMMAND + ["wf", "push", "--data-dir", "/tmp"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0, 1, 2], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf push --data-dir /tmp\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )


def test_wf_push_with_positional_args():
    """Test wf  push with positional arguments"""
    result = subprocess.run(CLI_COMMAND + ["wf", "push", "test_workflow_id"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0, 1, 2], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf push test_workflow_id\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )


def test_wf_push_missing_required_args():
    """Test wf  push with missing required arguments"""
    result = subprocess.run(CLI_COMMAND + ["wf", "push"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [2], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf push\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )
    assert "Error:" in result.stdout or "Error:" in result.stderr, (
        f"Expected 'Error:' in output\n" f"stdout: {result.stdout[:500]}\n" f"stderr: {result.stderr[:500]}"
    )


def test_wf_search_help():
    """Test wf  search --help"""
    result = subprocess.run(CLI_COMMAND + ["wf", "search", "--help"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf search --help\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )
    assert "Usage:" in result.stdout or "Usage:" in result.stderr, (
        f"Expected 'Usage:' in output\n" f"stdout: {result.stdout[:500]}\n" f"stderr: {result.stderr[:500]}"
    )


def test_wf_search_data_dir_valid_path():
    """Test wf  search with valid --data-dir"""
    result = subprocess.run(CLI_COMMAND + ["wf", "search", "--data-dir", "/tmp"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0, 1, 2], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf search --data-dir /tmp\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )


def test_wf_search_output_json_flag():
    """Test wf  search with --output-json flag"""
    result = subprocess.run(CLI_COMMAND + ["wf", "search", "--output-json"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0, 1, 2], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf search --output-json\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )


def test_wf_search_output_table_flag():
    """Test wf  search with --output-table flag"""
    result = subprocess.run(CLI_COMMAND + ["wf", "search", "--output-table"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0, 1, 2], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf search --output-table\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )


def test_wf_search_with_positional_args():
    """Test wf  search with positional arguments"""
    result = subprocess.run(CLI_COMMAND + ["wf", "search", "test_query"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0, 1, 2], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf search test_query\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )


def test_wf_search_missing_required_args():
    """Test wf  search with missing required arguments"""
    result = subprocess.run(CLI_COMMAND + ["wf", "search"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [2], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf search\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )
    assert "Error:" in result.stdout or "Error:" in result.stderr, (
        f"Expected 'Error:' in output\n" f"stdout: {result.stdout[:500]}\n" f"stderr: {result.stderr[:500]}"
    )


def test_wf_server_help():
    """Test wf  server --help"""
    result = subprocess.run(CLI_COMMAND + ["wf", "server", "--help"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf server --help\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )
    assert "Usage:" in result.stdout or "Usage:" in result.stderr, (
        f"Expected 'Usage:' in output\n" f"stdout: {result.stdout[:500]}\n" f"stderr: {result.stderr[:500]}"
    )


def test_wf_server_no_args():
    """Test wf  server with no arguments"""
    result = subprocess.run(CLI_COMMAND + ["wf", "server"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0, 1], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf server\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )


def test_wf_server_skip_ssl_verify_flag():
    """Test wf  server with --skip-ssl-verify flag"""
    result = subprocess.run(CLI_COMMAND + ["wf", "server", "--skip-ssl-verify"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0, 1, 2], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf server --skip-ssl-verify\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )


def test_wf_server_data_dir_valid_path():
    """Test wf  server with valid --data-dir"""
    result = subprocess.run(CLI_COMMAND + ["wf", "server", "--data-dir", "/tmp"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0, 1, 2], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf server --data-dir /tmp\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )


def test_wf_server_output_json_flag():
    """Test wf  server with --output-json flag"""
    result = subprocess.run(CLI_COMMAND + ["wf", "server", "--output-json"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0, 1, 2], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf server --output-json\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )


def test_wf_server_output_table_flag():
    """Test wf  server with --output-table flag"""
    result = subprocess.run(CLI_COMMAND + ["wf", "server", "--output-table"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0, 1, 2], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf server --output-table\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )


def test_wf_stats_help():
    """Test wf  stats --help"""
    result = subprocess.run(CLI_COMMAND + ["wf", "stats", "--help"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf stats --help\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )
    assert "Usage:" in result.stdout or "Usage:" in result.stderr, (
        f"Expected 'Usage:' in output\n" f"stdout: {result.stdout[:500]}\n" f"stderr: {result.stderr[:500]}"
    )


def test_wf_stats_data_dir_valid_path():
    """Test wf  stats with valid --data-dir"""
    result = subprocess.run(CLI_COMMAND + ["wf", "stats", "--data-dir", "/tmp"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0, 1, 2], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf stats --data-dir /tmp\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )


def test_wf_stats_output_json_flag():
    """Test wf  stats with --output-json flag"""
    result = subprocess.run(CLI_COMMAND + ["wf", "stats", "--output-json"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0, 1, 2], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf stats --output-json\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )


def test_wf_stats_output_table_flag():
    """Test wf  stats with --output-table flag"""
    result = subprocess.run(CLI_COMMAND + ["wf", "stats", "--output-table"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0, 1, 2], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf stats --output-table\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )


def test_wf_stats_with_positional_args():
    """Test wf  stats with positional arguments"""
    result = subprocess.run(CLI_COMMAND + ["wf", "stats", "test_workflow_id"], capture_output=True, text=True, timeout=60)
    assert result.returncode in [0, 1, 2], (
        f"Command failed with exit code {result.returncode}\n"
        f"Command: wf stats test_workflow_id\n"
        f"stdout: {result.stdout[:500]}\n"
        f"stderr: {result.stderr[:500]}"
    )
