本文整理汇总了Python中blogger.Blogger.new方法的典型用法代码示例。如果您正苦于以下问题:Python Blogger.new方法的具体用法?Python Blogger.new怎么用?Python Blogger.new使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类blogger.Blogger
的用法示例。
在下文中一共展示了Blogger.new方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_new
# 需要导入模块: from blogger import Blogger [as 别名]
# 或者: from blogger.Blogger import new [as 别名]
def test_new(self):
b = Blogger.new(self.handler, auth_entity=self.auth_entity)
self.assertEquals(self.auth_entity.key, b.auth_entity)
self.assertEquals('name', b.name)
self.assertEquals(['http://my.blawg/'], b.domain_urls)
self.assertEquals(['my.blawg'], b.domains)
self.assertEquals('http://pic', b.picture)
示例2: test_create_comment
# 需要导入模块: from blogger import Blogger [as 别名]
# 或者: from blogger.Blogger import new [as 别名]
def test_create_comment(self):
self.expect_get_posts()
self.client.add_comment('111', '222', '<a href="http://who">who</a>: foo bar'
).AndReturn(self.comment)
self.mox.ReplayAll()
b = Blogger.new(self.handler, auth_entity=self.auth_entity)
resp = b.create_comment('http://blawg/path/to/post', 'who', 'http://who',
'foo bar', client=self.client)
self.assert_equals({'id': '333', 'response': '<foo></foo>'}, resp)
示例3: test_create_too_long_comment
# 需要导入模块: from blogger import Blogger [as 别名]
# 或者: from blogger.Blogger import new [as 别名]
def test_create_too_long_comment(self):
"""Blogger caps totally HTML comment length at 4096 chars."""
self.expect_get_posts()
self.client.add_comment(
'111', '222', u'<a href="http://who">Degenève</a>: foo Degenève bar'
).AndReturn(self.comment)
self.mox.ReplayAll()
b = Blogger.new(self.handler, auth_entity=self.auth_entity)
resp = b.create_comment('http://blawg/path/to/post', u'Degenève', 'http://who',
u'foo Degenève bar', client=self.client)
示例4: test_create_comment_gives_up_on_internal_error_bX2i87au
# 需要导入模块: from blogger import Blogger [as 别名]
# 或者: from blogger.Blogger import new [as 别名]
def test_create_comment_gives_up_on_internal_error_bX2i87au(self):
# see https://github.com/snarfed/bridgy/issues/175
self.expect_get_posts()
self.client.add_comment('111', '222', '<a href="http://who">who</a>: foo bar'
).AndRaise(RequestError('500, Internal error: bX-2i87au'))
self.mox.ReplayAll()
b = Blogger.new(self.handler, auth_entity=self.auth_entity)
resp = b.create_comment('http://blawg/path/to/post', 'who', 'http://who',
'foo bar', client=self.client)
# the key point is that create_comment doesn't raise an exception
self.assert_equals({'error': '500, Internal error: bX-2i87au'}, resp)
示例5: test_create_comment_with_unicode_chars
# 需要导入模块: from blogger import Blogger [as 别名]
# 或者: from blogger.Blogger import new [as 别名]
def test_create_comment_with_unicode_chars(self):
# TODO: this just checks the arguments passed to client.add_comment(). we
# should test that the blogger client itself encodes as UTF-8.
self.expect_get_posts()
prefix = u'<a href="http://who">Degenève</a>: '
content = prefix + 'x' * (blogger.MAX_COMMENT_LENGTH - len(prefix) - 3) + '...'
self.client.add_comment('111', '222', content).AndReturn(self.comment)
self.mox.ReplayAll()
b = Blogger.new(self.handler, auth_entity=self.auth_entity)
resp = b.create_comment('http://blawg/path/to/post', u'Degenève', 'http://who',
'x' * blogger.MAX_COMMENT_LENGTH, client=self.client)
示例6: test_new_no_blogs
# 需要导入模块: from blogger import Blogger [as 别名]
# 或者: from blogger.Blogger import new [as 别名]
def test_new_no_blogs(self):
self.auth_entity.blog_hostnames = []
self.assertIsNone(Blogger.new(self.handler, auth_entity=self.auth_entity))
self.assertIn('Blogger blog not found', next(iter(self.handler.messages)))
示例7: test_feed_url
# 需要导入模块: from blogger import Blogger [as 别名]
# 或者: from blogger.Blogger import new [as 别名]
def test_feed_url(self):
self.assertEquals(
'http://my.blawg/feeds/posts/default',
Blogger.new(self.handler, auth_entity=self.auth_entity).feed_url())