Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
gkostin1966 committed Mar 4, 2025
1 parent abceb17 commit 52f44ae
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 12 deletions.
4 changes: 2 additions & 2 deletions dor/providers/translocator.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def get_bundle(self, entries: list[Path]) -> Bundle:
entries=entries
)


class FakeTranslocator:

def create_workspace_for_package(self, package_identifier: str) -> FakeWorkspace:
Expand All @@ -52,7 +53,7 @@ def create_workspace_for_package(self, package_identifier: str) -> FakeWorkspace

class Translocator():

def __init__(self, inbox_path: Path, workspaces_path: Path, minter: Callable[[],str], file_provider: FileProvider) -> None:
def __init__(self, inbox_path: Path, workspaces_path: Path, minter: Callable[[], str], file_provider: FileProvider) -> None:
self.inbox_path = inbox_path
self.workspaces_path = workspaces_path
self.minter = minter
Expand All @@ -65,4 +66,3 @@ def create_workspace_for_package(self, package_identifier: str) -> Workspace:
self.inbox_path / package_identifier, workspace_path
)
return Workspace(str(workspace_path))

2 changes: 1 addition & 1 deletion dor/service_layer/handlers/catalog_revision.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ def catalog_revision(event: PackageStored, uow: AbstractUnitOfWork) -> None:
identifier=event.identifier,
workspace_identifier=event.workspace_identifier,
tracking_identifier=event.tracking_identifier,
package_identifier=event.package_identifier,
package_identifier=event.package_identifier
))

1 change: 0 additions & 1 deletion features/steps/test_store_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
from gateway.ocfl_repository_gateway import OcflRepositoryGateway
from utils.minter import minter


@dataclass
class PathData:
scratch: Path
Expand Down
2 changes: 1 addition & 1 deletion features/steps/test_update_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def test_updating_only_metadata_of_a_resource_for_immediate_release():
def _(
path_data: PathData, unit_of_work: AbstractUnitOfWork, message_bus: MemoryMessageBus
):
"""a package containing all the scanned pages, OCR, and metadata."""
"""a package containing updated resource metadata"""
file_provider = FilesystemFileProvider()
file_provider.delete_dir_and_contents(path=path_data.scratch)
file_provider.create_directory(path_data.scratch)
Expand Down
11 changes: 4 additions & 7 deletions tests/test_translocator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
from dor.providers.file_system_file_provider import FilesystemFileProvider
from dor.providers.translocator import Translocator

from utils.minter import minter

@pytest.fixture
def workspaces_path() -> Path:
return Path("tests/test_workspaces")
Expand All @@ -17,22 +15,21 @@ def inbox_path() -> Path:

def test_create_translocator(inbox_path: Path, workspaces_path: Path) -> None:
Translocator(
inbox_path=inbox_path, workspaces_path=workspaces_path, minter=minter, file_provider=FilesystemFileProvider()
inbox_path=inbox_path, workspaces_path=workspaces_path, minter=lambda: "some_id", file_provider=FilesystemFileProvider()
)

def test_translocator_can_create_workspace(inbox_path: Path, workspaces_path: Path) -> None:
mint = 'a2574fa4-f169-48b5-a5df-6287fe5ef1aa'
file_provider = FilesystemFileProvider()
file_provider.delete_dir_and_contents(
Path(workspaces_path / mint)
Path(workspaces_path / "some_id")
)
translocator = Translocator(
inbox_path=inbox_path,
workspaces_path=workspaces_path,
minter=lambda : mint,
minter=lambda : "some_id",
file_provider=file_provider
)
workspace = translocator.create_workspace_for_package("xyzzy-0001-v1")

assert workspace.identifier == str(workspaces_path / mint)
assert workspace.identifier == str(workspaces_path / "some_id")
assert Path(workspace.identifier).exists()

0 comments on commit 52f44ae

Please sign in to comment.