Skip to content

Commit

Permalink
More test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
SolarDrew committed Sep 11, 2024
1 parent f47edf4 commit 451f37d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
14 changes: 14 additions & 0 deletions dkist/net/globus/tests/test_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,20 @@ def test_start_transfer_src_base(mocker, transfer_client, mock_endpoints):
assert f"{os.path.sep}b{os.path.sep}" + filepath.name == tfr["destination_path"]


def test_start_transfer_multiple_paths(mocker, transfer_client, mock_endpoints):
submit_mock = mocker.patch("globus_sdk.TransferClient.submit_transfer",
return_value={"task_id": "task_id"})
mocker.patch("globus_sdk.TransferClient.get_submission_id",
return_value={"value": "wibble"})
file_list = list(map(Path, ["/a/name.fits", "/a/name2.fits"]))
dst_list = list(map(Path, ["/aplace/newname.fits", "/anotherplace/newname2.fits"]))
start_transfer_from_file_list("a", "b", dst_list, file_list)
transfer_manifest = submit_mock.call_args_list[0][0][0]["DATA"]

for filepath, tfr in zip(dst_list, transfer_manifest):
assert str(filepath) == tfr["destination_path"]


def test_process_event_list(transfer_client, mock_task_event_list):
(events,
json_events,
Expand Down
3 changes: 2 additions & 1 deletion dkist/net/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,9 @@ def transfer_complete_datasets(datasets: str | Iterable[str] | QueryResponseRow
label = f"DKIST Python Tools - {now} - {datasetids}"

# Globus limits labels to 128 characters, so truncate if needed
# In principle this can't happen because of the truncation above, but just in case
if len(label) > 128:
label = label[:125] + "..."
label = label[:125] + "..." # pragma: no cover

_orchestrate_transfer_task(source_paths,
recursive=True,
Expand Down

0 comments on commit 451f37d

Please sign in to comment.