feat(cli): add shorthand error helpers, usage polling on bare box, and comprehensive help manuals
This commit is contained in:
@@ -58,5 +58,63 @@ class TestBoxWork(unittest.TestCase):
|
||||
self.assertFalse(res["ready"])
|
||||
self.assertEqual(res["overall"], "FAIL")
|
||||
|
||||
def test_cli_alone_prints_usage_reference(self):
|
||||
import subprocess
|
||||
proc = subprocess.run([sys.executable, str(REPO_ROOT / "bin" / "super-cli.py")], capture_output=True, text=True)
|
||||
self.assertEqual(proc.returncode, 0)
|
||||
self.assertIn("BOX ORCHESTRATOR: INPUT PARAMETERS & USAGE REFERENCE", proc.stdout)
|
||||
self.assertIn("PRIMARY DOMAINS & INPUT PARAMETERS:", proc.stdout)
|
||||
self.assertIn("box work", proc.stdout)
|
||||
self.assertIn("box tasks", proc.stdout)
|
||||
self.assertIn("box fleet", proc.stdout)
|
||||
|
||||
def test_cli_help_prints_master_manual(self):
|
||||
import subprocess
|
||||
proc = subprocess.run([sys.executable, str(REPO_ROOT / "bin" / "super-cli.py"), "help"], capture_output=True, text=True)
|
||||
self.assertEqual(proc.returncode, 0)
|
||||
self.assertIn("BOX ORCHESTRATOR COMPREHENSIVE CLI & RUNTIME MANUAL", proc.stdout)
|
||||
self.assertIn("DOMAINS & ACTION SPECIFICATIONS:", proc.stdout)
|
||||
|
||||
def test_cli_domain_help_prints_subcommands_and_examples(self):
|
||||
import subprocess
|
||||
proc = subprocess.run([sys.executable, str(REPO_ROOT / "bin" / "super-cli.py"), "work", "help"], capture_output=True, text=True)
|
||||
self.assertEqual(proc.returncode, 0)
|
||||
self.assertIn("SHORTHAND EXAMPLES:", proc.stdout)
|
||||
self.assertIn("OPERATIONAL GUIDELINES:", proc.stdout)
|
||||
self.assertIn("box work start", proc.stdout)
|
||||
|
||||
def test_cli_missing_args_prints_error_and_shorthand_helper(self):
|
||||
import subprocess
|
||||
proc = subprocess.run([sys.executable, str(REPO_ROOT / "bin" / "super-cli.py"), "work", "start"], capture_output=True, text=True)
|
||||
self.assertEqual(proc.returncode, 2)
|
||||
err = proc.stderr
|
||||
self.assertIn("CLI ERROR:", err)
|
||||
self.assertIn("SHORTHAND USAGE HELPER:", err)
|
||||
self.assertIn("title", err)
|
||||
self.assertIn("--to", err)
|
||||
self.assertIn("Quick Examples:", err)
|
||||
|
||||
def test_cli_invalid_subcommand_prints_shorthand_helper(self):
|
||||
import subprocess
|
||||
proc = subprocess.run([sys.executable, str(REPO_ROOT / "bin" / "super-cli.py"), "work", "invalid_action_xyz"], capture_output=True, text=True)
|
||||
self.assertEqual(proc.returncode, 2)
|
||||
err = proc.stderr
|
||||
self.assertIn("CLI ERROR:", err)
|
||||
self.assertIn("SHORTHAND USAGE HELPER:", err)
|
||||
self.assertIn("Available Subcommands:", err)
|
||||
self.assertIn("status", err)
|
||||
self.assertIn("start", err)
|
||||
|
||||
def test_cli_invalid_domain_prints_shorthand_helper(self):
|
||||
import subprocess
|
||||
proc = subprocess.run([sys.executable, str(REPO_ROOT / "bin" / "super-cli.py"), "invalid_domain_xyz"], capture_output=True, text=True)
|
||||
self.assertEqual(proc.returncode, 2)
|
||||
err = proc.stderr
|
||||
self.assertIn("CLI ERROR:", err)
|
||||
self.assertIn("SHORTHAND USAGE HELPER:", err)
|
||||
self.assertIn("Primary Domains & Commands:", err)
|
||||
self.assertIn("work", err)
|
||||
self.assertIn("fleet", err)
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user