Skip to content

Commit 6964aeb

Browse files
committed
format
1 parent bb77999 commit 6964aeb

2 files changed

Lines changed: 42 additions & 31 deletions

File tree

lib/galaxy/files/sources/invenio.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
)
1717
from urllib.parse import quote
1818

19-
log = logging.getLogger(__name__)
20-
2119
from typing_extensions import (
2220
TypedDict,
2321
)
2422

23+
log = logging.getLogger(__name__)
24+
2525
from galaxy.exceptions import (
2626
AuthenticationRequired,
2727
MessageException,

test/unit/files/test_invenio_multipart.py

Lines changed: 40 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
"""Unit tests for Invenio multipart upload functionality."""
22

3-
from unittest.mock import MagicMock, patch
3+
from unittest.mock import (
4+
MagicMock,
5+
patch,
6+
)
47

58
import pytest
69

@@ -239,13 +242,15 @@ def test_upload_file_multipart_success(self, tmp_path):
239242
file_path.write_bytes(b"x" * file_size)
240243

241244
interactor = _make_interactor()
242-
context = _make_context(config=MagicMock(
243-
multipart_threshold=1,
244-
multipart_chunk_size=None,
245-
default_resource_type=None,
246-
token="test-token",
247-
public_name="Doe, Jane",
248-
))
245+
context = _make_context(
246+
config=MagicMock(
247+
multipart_threshold=1,
248+
multipart_chunk_size=None,
249+
default_resource_type=None,
250+
token="test-token",
251+
public_name="Doe, Jane",
252+
)
253+
)
249254

250255
entries = _make_multipart_entries(3)
251256

@@ -283,13 +288,15 @@ def test_upload_file_multipart_wrong_part_count_from_server(self, tmp_path):
283288
file_path.write_bytes(b"x" * file_size)
284289

285290
interactor = _make_interactor()
286-
context = _make_context(config=MagicMock(
287-
multipart_threshold=1,
288-
multipart_chunk_size=None,
289-
default_resource_type=None,
290-
token="test-token",
291-
public_name="Doe, Jane",
292-
))
291+
context = _make_context(
292+
config=MagicMock(
293+
multipart_threshold=1,
294+
multipart_chunk_size=None,
295+
default_resource_type=None,
296+
token="test-token",
297+
public_name="Doe, Jane",
298+
)
299+
)
293300

294301
# Server returns only 2 part links instead of 3
295302
entries = _make_multipart_entries(2)
@@ -403,13 +410,15 @@ def test_routes_to_single_when_below_threshold(self, tmp_path):
403410
file_path.write_bytes(b"small")
404411

405412
interactor = _make_interactor()
406-
context = _make_context(config=MagicMock(
407-
multipart_threshold=100,
408-
multipart_chunk_size=None,
409-
default_resource_type=None,
410-
token="test-token",
411-
public_name="Doe, Jane",
412-
))
413+
context = _make_context(
414+
config=MagicMock(
415+
multipart_threshold=100,
416+
multipart_chunk_size=None,
417+
default_resource_type=None,
418+
token="test-token",
419+
public_name="Doe, Jane",
420+
)
421+
)
413422

414423
with patch.object(interactor, "_upload_file_single") as mock_single:
415424
interactor.upload_file_to_draft_container("abc", "test.txt", str(file_path), context)
@@ -422,13 +431,15 @@ def test_routes_to_multipart_when_above_threshold(self, tmp_path):
422431
file_path.write_bytes(b"x" * file_size)
423432

424433
interactor = _make_interactor()
425-
context = _make_context(config=MagicMock(
426-
multipart_threshold=1, # 1 MB threshold, file is 2 MB
427-
multipart_chunk_size=None,
428-
default_resource_type=None,
429-
token="test-token",
430-
public_name="Doe, Jane",
431-
))
434+
context = _make_context(
435+
config=MagicMock(
436+
multipart_threshold=1, # 1 MB threshold, file is 2 MB
437+
multipart_chunk_size=None,
438+
default_resource_type=None,
439+
token="test-token",
440+
public_name="Doe, Jane",
441+
)
442+
)
432443

433444
with patch.object(interactor, "_upload_file_multipart") as mock_multipart:
434445
interactor.upload_file_to_draft_container("abc", "test.txt", str(file_path), context)

0 commit comments

Comments
 (0)