diff --git a/tests/test_processing.py b/tests/test_processing.py index 82ff85742f..d726da8c05 100644 --- a/tests/test_processing.py +++ b/tests/test_processing.py @@ -154,19 +154,26 @@ def test_calculate_entropy_no_exception(path: Path, draw_plot: bool): @pytest.mark.parametrize( - "extract_root, path, extract_dir_prefix", + "extract_root, path, result", [ - ("/extract", "firmware", "firmware"), - ("/extract", "relative/firmware", "firmware"), - ("/extract", "/extract/dir/firmware", "dir/firmware"), - ("/extract/dir", "/extract/dir/firmware", "firmware"), - ("/extract", "/some/place/else/firmware", "firmware"), + ("/extract", "firmware", "/extract/firmware_extract"), + ("/extract", "relative/firmware", "/extract/firmware_extract"), + ("/extract", "/extract/dir/firmware", "/extract/dir/firmware_extract"), + ( + "/extract/dir", + "/extract/dir/firmware", + "/extract/dir/firmware_extract", + ), + ("/extract", "/some/place/else/firmware", "/extract/firmware_extract"), + ( + "extract", + "/some/place/else/firmware", + str(Path(".").resolve() / "extract/firmware_extract"), + ), ], ) def test_ExtractionConfig_get_extract_dir_for( - extract_root: str, path: str, extract_dir_prefix: str + extract_root: str, path: str, result: str ): cfg = ExtractionConfig(extract_root=Path(extract_root), entropy_depth=0) - assert cfg.get_extract_dir_for(Path(path)) == ( - cfg.extract_root / Path(extract_dir_prefix + cfg.extract_suffix) - ) + assert cfg.get_extract_dir_for(Path(path)) == Path(result) diff --git a/unblob/processing.py b/unblob/processing.py index 0502580909..b827604076 100644 --- a/unblob/processing.py +++ b/unblob/processing.py @@ -56,7 +56,7 @@ @attr.define(kw_only=True) class ExtractionConfig: - extract_root: Path + extract_root: Path = attr.field(converter=lambda value: value.resolve()) force_extract: bool = False entropy_depth: int entropy_plot: bool = False