feat(ecosystem): hub-core library lane for three-repo stack (HUB-WP-0003)
Add slugify_or_default for core-hub parity, bump to 0.2.0, document ecosystem position in INTENT/SCOPE/README, wire capability relations to state-hub and core-hub, and extend utils tests. Part of CUST-WP-0057 consolidation.
This commit is contained in:
parent
41a396e807
commit
118d4fdcfe
16 changed files with 1766 additions and 21 deletions
|
|
@ -2,7 +2,14 @@ import pytest
|
|||
from sqlalchemy import select
|
||||
|
||||
from hub_core.models.domain import Domain
|
||||
from hub_core.utils import PageParams, apply_pagination, normalize_trailing_slash, resolve_repo_path, slugify
|
||||
from hub_core.utils import (
|
||||
PageParams,
|
||||
apply_pagination,
|
||||
normalize_trailing_slash,
|
||||
resolve_repo_path,
|
||||
slugify,
|
||||
slugify_or_default,
|
||||
)
|
||||
|
||||
|
||||
class RepoStub:
|
||||
|
|
@ -19,6 +26,18 @@ def test_slugify_rejects_empty_slug() -> None:
|
|||
slugify(" !!! ")
|
||||
|
||||
|
||||
def test_slugify_or_default_matches_core_hub_bootstrap() -> None:
|
||||
assert slugify_or_default("ops-hub") == "ops-hub"
|
||||
assert slugify_or_default("Ops Hub Bootstrap") == "ops-hub-bootstrap"
|
||||
assert slugify_or_default("!!!") == "resource"
|
||||
assert slugify_or_default("!!!", default="fallback") == "fallback"
|
||||
|
||||
|
||||
def test_slugify_or_default_aligns_with_core_hub_api_v2_name_field() -> None:
|
||||
# core-hub: slug=body.get("slug") or slugify(body["name"])
|
||||
assert slugify_or_default("ops-hub") == "ops-hub"
|
||||
|
||||
|
||||
def test_page_params_bounds() -> None:
|
||||
assert PageParams(limit=10, offset=20).limit == 10
|
||||
with pytest.raises(ValueError, match="limit"):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue