Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions admin/test/scripts/test_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,11 @@ def mocked_lava_get_full_media_info(_media_ref_id):
all_artifacts_info = getattr(module, '__artifacts_v2__', {})
artifact_info = all_artifacts_info.get(artifact_name, {})

# The case zip is extracted into temp_dir, so temp_dir is this run's
# equivalent of the seeker's data folder. Without it get_relative_path
# is a no-op here and a path column records the recorder's own
# directory instead of the extraction-relative path.
Context.set_data_folder(str(temp_dir))
Context.set_report_folder(str(mock_report_folder_path))
Context.set_seeker(mock_seeker)
Context.set_files_found(all_files)
Expand Down
18 changes: 18 additions & 0 deletions scripts/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,24 @@ def set_output_params(output_params):
Context._output_params = output_params
Context._data_folder = getattr(output_params, 'data_folder', None)

@staticmethod
def set_data_folder(data_folder):
"""
Sets the folder the seeker stages evidence into, without the rest of the
output parameters.

A normal run gets this from set_output_params. The test harness has no
OutputParameters: it extracts a case zip into its own temporary directory
and runs artifacts against that. Without this, _data_folder stays None and
get_relative_path returns every path unchanged, so an artifact that leaks
an absolute path and one that reports a relative path record identical
output and no fixture can tell them apart.

Args:
data_folder (str): The folder evidence is staged into.
"""
Context._data_folder = data_folder

@staticmethod
def set_report_folder(report_folder):
"""
Expand Down
Loading