コード例 #1
0
ファイル: test_markdown.py プロジェクト: veselosky/bluebucket
def test_to_archetype3_catalog():
    archivist = S3archivist(testbucket,
                            s3=mock.Mock(),
                            siteconfig=siteconfig)
    rval = mark.to_archetype(archivist, doc3)
    print(json.dumps(rval))
    jsonschema.validate(rval, itemschema)
    jsonschema.validate(rval, catalogschema)
コード例 #2
0
ファイル: test_markdown.py プロジェクト: veselosky/bluebucket
def test_to_archetype2():
    archivist = S3archivist(testbucket,
                            s3=mock.Mock(),
                            siteconfig=siteconfig)
    rval = mark.to_archetype(archivist, doc2)
    print(json.dumps(rval))
    jsonschema.validate(rval, itemschema)
    assert rval['Item']['category']['name'] == "fake/content"
    assert rval['Item']['attribution'][0]['name'] == "Vince Veselosky"
    assert rval['Item']['itemtype'] == 'Item/Page/Article'
    assert rval['Item']['published'] == rval['Item']['updated']
コード例 #3
0
ファイル: test_markdown.py プロジェクト: veselosky/bluebucket
def test_to_archetype1():
    archivist = S3archivist(testbucket,
                            s3=mock.Mock(),
                            siteconfig=siteconfig)
    rval = mark.to_archetype(archivist, doc1)
    jsonschema.validate(rval, itemschema)
    assert rval['Item']['category']['name'] == "test/category"
    assert rval['Item']['attribution'][0]['name'] ==\
        'Vinnie "the Rueben" Veselosky'
    assert rval['Item']['itemtype'] == 'Item/Page/Article'
    assert rval['Item']['published'] == rval['Item']['updated']
    assert rval['Item']['slug'] == "spanish-lesson"
コード例 #4
0
ファイル: quill.py プロジェクト: veselosky/bluebucket
def publish(archivist, text):
    contentmeta = to_archetype(archivist, text)['Item']
    assetmeta = {
        'contenttype': 'text/markdown; charset=utf-8',
        'resourcetype': 'asset',
        'acl': 'public-read',
    }
    key = archivist.pathstrategy.path_for(**dict(contentmeta, **assetmeta))
    asset = archivist.new_resource(
        key=key,
        text=text,
        **assetmeta
    )
    archivist.publish(asset)