本文整理汇总了Python中redwind.models.Post.path方法的典型用法代码示例。如果您正苦于以下问题:Python Post.path方法的具体用法?Python Post.path怎么用?Python Post.path使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类redwind.models.Post
的用法示例。
在下文中一共展示了Post.path方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_send_wms
# 需要导入模块: from redwind.models import Post [as 别名]
# 或者: from redwind.models.Post import path [as 别名]
def test_send_wms(client, mocker):
getter = mocker.patch('requests.get')
poster = mocker.patch('requests.post')
urlopen = mocker.patch('urllib.request.urlopen')
post = Post('note')
post.content = 'This note links to [wikipedia](https://en.wikipedia.org/wiki/Webmention)'
post.content_html = 'This note links to <a href="https://en.wikipedia.org/wiki/Webmention">wikipedia</a>'
post.path = '2014/11/wm-sender-test'
db.session.add(post)
db.session.commit()
urlopen.return_value = FakeUrlOpen(
info=FakeUrlMetadata(content_type='text/html', content_length=256))
getter.return_value = FakeResponse(text="""<!DOCTYPE html>
<html>
<link rel="webmention" href="https://en.wikipedia.org/endpoint">
</html>""")
wm_sender.do_send_webmentions(post.id)
getter.assert_called_with('https://en.wikipedia.org/wiki/Webmention')
poster.assert_called_with('https://en.wikipedia.org/endpoint', data={
'source': post.permalink,
'target': 'https://en.wikipedia.org/wiki/Webmention',
}, headers={
'content-type': 'application/x-www-form-urlencoded',
'accept': 'application/json',
})
示例2: source_post
# 需要导入模块: from redwind.models import Post [as 别名]
# 或者: from redwind.models.Post import path [as 别名]
def source_post(app, db):
post = Post('note')
post.content = 'This note links to [wikipedia](https://en.wikipedia.org/wiki/Webmention)'
post.content_html = 'This note links to <a href="https://en.wikipedia.org/wiki/Webmention">wikipedia</a>'
post.path = '2014/11/wm-sender-test'
db.session.add(post)
db.session.commit()
return post