示例#1
0
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"
示例#2
0
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"
示例#3
0
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"
示例#4
0
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"
示例#5
0
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)