generated from coulomb/repo-seed
feat: reuse hub-core base schemas
This commit is contained in:
@@ -1,8 +1,23 @@
|
||||
from api.schemas.agent_message import MessageCreate
|
||||
from api.schemas.capability_request import (
|
||||
CapabilityRequestDispute,
|
||||
CapabilityRequestStatusPatch,
|
||||
CatalogCreate,
|
||||
CatalogPatch,
|
||||
CatalogRead,
|
||||
)
|
||||
from api.schemas.doi import DoIReport
|
||||
from api.schemas.domain import DomainCreate, DomainRead, DomainRename, DomainUpdate
|
||||
from api.schemas.managed_repo import RepoCreate, RepoPathRegister, RepoRead
|
||||
from api.schemas.tpsc import GDPR_WARNING_LEVELS, TPSCCatalogRead, TPSCGDPRReport
|
||||
from hub_core.schemas.agent_message import MessageCreate as CoreMessageCreate
|
||||
from hub_core.schemas.capability import (
|
||||
CapabilityRequestDispute as CoreCapabilityRequestDispute,
|
||||
CapabilityRequestStatusPatch as CoreCapabilityRequestStatusPatch,
|
||||
CatalogCreate as CoreCatalogCreate,
|
||||
CatalogPatch as CoreCatalogPatch,
|
||||
CatalogRead as CoreCatalogRead,
|
||||
)
|
||||
from hub_core.schemas.doi import DoIReport as CoreDoIReport
|
||||
from hub_core.schemas.domain import (
|
||||
DomainCreate as CoreDomainCreate,
|
||||
@@ -10,6 +25,11 @@ from hub_core.schemas.domain import (
|
||||
DomainRename as CoreDomainRename,
|
||||
DomainUpdate as CoreDomainUpdate,
|
||||
)
|
||||
from hub_core.schemas.managed_repo import (
|
||||
RepoCreate as CoreRepoCreate,
|
||||
RepoPathRegister as CoreRepoPathRegister,
|
||||
RepoRead as CoreRepoRead,
|
||||
)
|
||||
from hub_core.schemas.tpsc import (
|
||||
GDPR_WARNING_LEVELS as CORE_GDPR_WARNING_LEVELS,
|
||||
TPSCCatalogRead as CoreTPSCCatalogRead,
|
||||
@@ -32,6 +52,25 @@ def test_state_hub_reexports_core_domain_base_schemas() -> None:
|
||||
assert DomainUpdate is CoreDomainUpdate
|
||||
|
||||
|
||||
def test_state_hub_reexports_core_capability_base_schemas() -> None:
|
||||
assert CatalogCreate is CoreCatalogCreate
|
||||
assert CatalogPatch is CoreCatalogPatch
|
||||
assert CatalogRead is CoreCatalogRead
|
||||
assert CapabilityRequestDispute is CoreCapabilityRequestDispute
|
||||
assert CapabilityRequestStatusPatch is CoreCapabilityRequestStatusPatch
|
||||
|
||||
|
||||
def test_state_hub_reexports_core_repo_path_schema() -> None:
|
||||
assert RepoPathRegister is CoreRepoPathRegister
|
||||
|
||||
|
||||
def test_state_hub_repo_schemas_extend_core_contracts() -> None:
|
||||
assert issubclass(RepoCreate, CoreRepoCreate)
|
||||
assert issubclass(RepoRead, CoreRepoRead)
|
||||
assert "topic_id" in RepoCreate.model_fields
|
||||
assert "last_state_synced_at" in RepoRead.model_fields
|
||||
|
||||
|
||||
def test_state_hub_reexports_core_tpsc_schemas() -> None:
|
||||
assert TPSCCatalogRead is CoreTPSCCatalogRead
|
||||
assert TPSCGDPRReport is CoreTPSCGDPRReport
|
||||
|
||||
@@ -75,6 +75,23 @@ class TestDomains:
|
||||
assert r.status_code == 409
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Repo tests
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
class TestRepos:
|
||||
async def test_create_persists_host_paths(self, client):
|
||||
await _create_domain(client)
|
||||
r = await client.post("/repos/", json={
|
||||
"domain_slug": "testdomain",
|
||||
"slug": "hosted-repo",
|
||||
"name": "Hosted Repo",
|
||||
"host_paths": {"workstation": "/srv/hosted-repo"},
|
||||
})
|
||||
assert r.status_code == 201
|
||||
assert r.json()["host_paths"] == {"workstation": "/srv/hosted-repo"}
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Topic tests
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user