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
3 changes: 2 additions & 1 deletion src/onc/modules/_OncDelivery.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,8 @@ def _printProductOrderStats(self, fileList: list, runInfo: dict):
print(f"Total download Time: {txtDownTime}")

# Print size and count of files
print(f"{downloadCount} files ({humanize.naturalsize(size)}) downloaded")
natural_size = humanize.naturalsize(size, binary=True)
print(f"{downloadCount} files ({natural_size}) downloaded")
else:
print("No files downloaded.")

Expand Down
2 changes: 1 addition & 1 deletion src/onc/modules/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def saveAsFile(
raise FileExistsError(filePath)

start = time.time()
size = 0
size = len(response.content)
with open(filePath, "wb") as file:
file.write(response.content)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ def test_valid_no_metadata(requester, params, expected_keys_download_results, ut
assert data["downloadResults"][0]["index"] == "1"
assert data["downloadResults"][0]["downloaded"] is True

assert data["stats"]["totalSize"] != 0

assert util.get_download_files_num(requester) == 2, "The first two are png files."

util.assert_dict_key_types(
Expand Down