diff --git a/tests/test_forensics.py b/tests/test_forensics.py index 8277b72..335836c 100644 --- a/tests/test_forensics.py +++ b/tests/test_forensics.py @@ -248,6 +248,37 @@ def test_forensics_inspect_cli_success(): assert "Detected Type" in result.output assert "PNG Image" in result.output +def test_root_inspect_cli_success(): + """ + Verifies that 'ctf inspect' successfully runs at the root level and prints + the metadata in a formatted table. + """ + from ctf.main import cli + runner = CliRunner() + test_file = TEST_ENV / "test_file_root.png" + with open(test_file, "wb") as f: + f.write(b"\x89PNG\r\n\x1a\n") + + result = runner.invoke(cli, ["inspect", str(test_file)]) + assert result.exit_code == 0 + assert "Metadata: test_file_root.png" in result.output + assert "PNG Image" in result.output + +def test_nested_inspect_cli_success(): + """ + Verifies that 'ctf forensics inspect' successfully runs via the root CLI. + """ + from ctf.main import cli + runner = CliRunner() + test_file = TEST_ENV / "test_file_nested.png" + with open(test_file, "wb") as f: + f.write(b"\x89PNG\r\n\x1a\n") + + result = runner.invoke(cli, ["forensics", "inspect", str(test_file)]) + assert result.exit_code == 0 + assert "Metadata: test_file_nested.png" in result.output + assert "PNG Image" in result.output + def test_forensics_inspect_cli_missing_file(): """ Verifies that the CLI fails gracefully when a non-existent file path is specified.