[GEMINI] Update test imports and mock paths to point to ctf.cli package
This commit is contained in:
@@ -1,7 +1,5 @@
|
|||||||
# tests/test_commands.py
|
|
||||||
from pathlib import Path
|
|
||||||
from click.testing import CliRunner
|
from click.testing import CliRunner
|
||||||
from ctf.commands import basic_group
|
from ctf.cli.basic import basic_group
|
||||||
from ctf.config import Config
|
from ctf.config import Config
|
||||||
|
|
||||||
# {{{ test_basic_test_cli
|
# {{{ test_basic_test_cli
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import sys
|
|||||||
from click.testing import CliRunner
|
from click.testing import CliRunner
|
||||||
from ctf.utils import active_categories
|
from ctf.utils import active_categories
|
||||||
from ctf.forensics import get_metadata
|
from ctf.forensics import get_metadata
|
||||||
from ctf.cli_forensics import forensics_group, metadata
|
from ctf.cli.forensics import forensics_group, metadata
|
||||||
|
|
||||||
# Define the persistent test environment path
|
# Define the persistent test environment path
|
||||||
TEST_ENV = Path("tests/env")
|
TEST_ENV = Path("tests/env")
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ def test_cli_crack_steghide_success(tmp_path):
|
|||||||
payload=b"flag{cli_steg_preview}"
|
payload=b"flag{cli_steg_preview}"
|
||||||
)
|
)
|
||||||
|
|
||||||
with patch("ctf.cli_steg.crack_steghide", return_value=mock_result):
|
with patch("ctf.cli.steg.crack_steghide", return_value=mock_result):
|
||||||
res = runner.invoke(cli, ["steg", "crack-steghide", str(mock_file), "-w", str(wordlist_file)])
|
res = runner.invoke(cli, ["steg", "crack-steghide", str(mock_file), "-w", str(wordlist_file)])
|
||||||
assert res.exit_code == 0
|
assert res.exit_code == 0
|
||||||
assert "Successfully cracked!" in res.output
|
assert "Successfully cracked!" in res.output
|
||||||
@@ -127,7 +127,7 @@ def test_cli_crack_steghide_success_output_file(tmp_path):
|
|||||||
payload=b"written_file_content"
|
payload=b"written_file_content"
|
||||||
)
|
)
|
||||||
|
|
||||||
with patch("ctf.cli_steg.crack_steghide", return_value=mock_result):
|
with patch("ctf.cli.steg.crack_steghide", return_value=mock_result):
|
||||||
res = runner.invoke(cli, ["steg", "crack-steghide", str(mock_file), "-w", str(wordlist_file), "-o", str(out_file)])
|
res = runner.invoke(cli, ["steg", "crack-steghide", str(mock_file), "-w", str(wordlist_file), "-o", str(out_file)])
|
||||||
assert res.exit_code == 0
|
assert res.exit_code == 0
|
||||||
assert "Successfully cracked!" in res.output
|
assert "Successfully cracked!" in res.output
|
||||||
@@ -152,7 +152,7 @@ def test_cli_crack_steghide_failure(tmp_path):
|
|||||||
error_message="Password not found in wordlist."
|
error_message="Password not found in wordlist."
|
||||||
)
|
)
|
||||||
|
|
||||||
with patch("ctf.cli_steg.crack_steghide", return_value=mock_result):
|
with patch("ctf.cli.steg.crack_steghide", return_value=mock_result):
|
||||||
res = runner.invoke(cli, ["steg", "crack-steghide", str(mock_file), "-w", str(wordlist_file)])
|
res = runner.invoke(cli, ["steg", "crack-steghide", str(mock_file), "-w", str(wordlist_file)])
|
||||||
assert res.exit_code == 0
|
assert res.exit_code == 0
|
||||||
assert "Cracking failed: Password not found in wordlist" in res.output
|
assert "Cracking failed: Password not found in wordlist" in res.output
|
||||||
|
|||||||
Reference in New Issue
Block a user