def test_markdown_source_asset(): p = DefaultPathStrategy() meta = { "resourcetype": "asset", "itemtype": "Item/Page/Article", "contenttype": "text/markdown; charset=utf-8", "guid": "653f3ad8-cf4e-43db-afcb-a06ff3e2bfdb", } target = p.path_for(**meta) assert target == "_A/Source/text/markdown/653f3ad8-cf4e-43db-afcb-a06ff3e2bfdb.md"
def test_archetype(): p = DefaultPathStrategy() meta = { "resourcetype": "archetype", "itemtype": "item/page/article", "contenttype": "application/json", "guid": "653f3ad8-cf4e-43db-afcb-a06ff3e2bfdb", } target = p.path_for(**meta) assert target == "_A/Item/Page/Article/653f3ad8-cf4e-43db-afcb-a06ff3e2bfdb.json"
def test_catalog_archetype_as_xml(): p = DefaultPathStrategy() meta = { "resourcetype": "artifact", "itemtype": "Item/Page/Catalog", "contenttype": "application/atom+xml", "category": {"name": "test/category"}, "slug": "catalog-slug", } answer = p.path_for(**meta) assert answer == "test/category/catalog-slug.xml"
def test_catalog_archetype(): p = DefaultPathStrategy() meta = { "resourcetype": "artifact", "itemtype": "Item/Page/Catalog", "contenttype": "text/html; charset=utf-8", "category": {"name": "test/category"}, "slug": "catalog-slug", } answer = p.path_for(**meta) assert answer == "test/category/catalog-slug.html"
def test_markdown_source_no_guid(): p = DefaultPathStrategy() meta = {"resourcetype": "asset", "itemtype": "Item/Page/Article", "contenttype": "text/markdown; charset=utf-8"} with pytest.raises(Exception): p.path_for(**meta)