当前位置: 首页>>代码示例>>Python>>正文


Python Blogger.new方法代码示例

本文整理汇总了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)
开发者ID:dev511,项目名称:bridgy,代码行数:9,代码来源:blogger_test.py

示例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)
开发者ID:dev511,项目名称:bridgy,代码行数:12,代码来源:blogger_test.py

示例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)
开发者ID:notenoughneon,项目名称:bridgy,代码行数:13,代码来源:blogger_test.py

示例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)
开发者ID:dev511,项目名称:bridgy,代码行数:14,代码来源:blogger_test.py

示例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)
开发者ID:notenoughneon,项目名称:bridgy,代码行数:15,代码来源:blogger_test.py

示例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)))
开发者ID:dev511,项目名称:bridgy,代码行数:6,代码来源:blogger_test.py

示例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())
开发者ID:dev511,项目名称:bridgy,代码行数:6,代码来源:blogger_test.py


注:本文中的blogger.Blogger.new方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。