﻿# tests/test_commands.py
# STEP 3 Feature 3: Command system testing
# Lines: 30 - Test: YES - Rollback: Remove-Item

import sys
import os
import subprocess
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

def test_status_command():
    """Test control tower status command"""
    try:
        result = subprocess.run(
            ["python", "control_tower.py", "status"],
            capture_output=True,
            text=True,
            timeout=5
        )
        assert result.returncode == 0
        assert "RateRight Control Tower Status" in result.stdout
        print("EVIDENCE: Status command works")
        assert True  # Command test passed
    except Exception as e:
        print(f"FAILED: {e}")
        assert False, "Command test failed"

def test_list_command():
    """Test list command"""
    try:
        result = subprocess.run(
            ["python", "control_tower.py", "list"],
            capture_output=True,
            text=True,
            timeout=5
        )
        assert result.returncode == 0
        print("EVIDENCE: List command works")
        assert True  # Command test passed
    except Exception as e:
        print(f"FAILED: {e}")
        assert False, "Command test failed"

if __name__ == "__main__":
    if test_status_command():
        print("[PASS] Status command test")
    if test_list_command():
        print("[PASS] List command test")

