34 lines
1.1 KiB
Python
34 lines
1.1 KiB
Python
from packages.adapters.sqlalchemy_impl.asset_library_repository import SQLAlchemyAssetLibraryRepository
|
|
from packages.adapters.sqlalchemy_impl.models import AssetLibraryModel
|
|
from tests.unit.test_workspace_sqlalchemy_repositories import _sqlite_session
|
|
|
|
|
|
def test_asset_library_repository_get_returns_library():
|
|
session = _sqlite_session()
|
|
session.add(
|
|
AssetLibraryModel(
|
|
id="lib-1",
|
|
workspace_id="workspace-1",
|
|
project_id="project-1",
|
|
name="素材库",
|
|
kind="video",
|
|
asset_count=2,
|
|
total_size=10,
|
|
)
|
|
)
|
|
session.commit()
|
|
|
|
library = SQLAlchemyAssetLibraryRepository(session).get("lib-1")
|
|
|
|
assert library is not None
|
|
assert library.id == "lib-1"
|
|
assert library.workspace_id == "workspace-1"
|
|
assert library.project_id == "project-1"
|
|
assert library.kind.value == "video"
|
|
|
|
|
|
def test_asset_library_repository_get_returns_none_for_missing_library():
|
|
session = _sqlite_session()
|
|
|
|
assert SQLAlchemyAssetLibraryRepository(session).get("missing") is None
|