本文整理汇总了Python中tumblr.Tumblr.new方法的典型用法代码示例。如果您正苦于以下问题:Python Tumblr.new方法的具体用法?Python Tumblr.new怎么用?Python Tumblr.new使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tumblr.Tumblr
的用法示例。
在下文中一共展示了Tumblr.new方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_new
# 需要导入模块: from tumblr import Tumblr [as 别名]
# 或者: from tumblr.Tumblr import new [as 别名]
def test_new(self):
t = Tumblr.new(self.handler, auth_entity=self.auth_entity)
self.assertEquals(self.auth_entity.key, t.auth_entity)
self.assertEquals('name', t.name)
self.assertEquals(['http://primary/'], t.domain_urls)
self.assertEquals(['primary'], t.domains)
self.assertEquals('http://api.tumblr.com/v2/blog/primary/avatar/512', t.picture)
示例2: test_verify_without_disqus
# 需要导入模块: from tumblr import Tumblr [as 别名]
# 或者: from tumblr.Tumblr import new [as 别名]
def test_verify_without_disqus(self):
self.expect_webmention_requests_get('http://primary/', 'no disqus here!',
verify=False)
self.mox.ReplayAll()
t = Tumblr.new(self.handler, auth_entity=self.auth_entity, features=['webmention'])
t.verify()
self.assertIsNone(t.disqus_shortname)
示例3: _test_verify_finds_disqus
# 需要导入模块: from tumblr import Tumblr [as 别名]
# 或者: from tumblr.Tumblr import new [as 别名]
def _test_verify_finds_disqus(self, snippet):
# this requests.get is called by webmention-tools
self.expect_requests_get(
'http://primary/', '<html>\nstuff\n%s\n</html>' % snippet, verify=False)
self.mox.ReplayAll()
t = Tumblr.new(self.handler, auth_entity=self.auth_entity, features=['webmention'])
t.verify()
self.assertEquals('my-disqus-name', t.disqus_shortname)
示例4: test_new_with_blog_name
# 需要导入模块: from tumblr import Tumblr [as 别名]
# 或者: from tumblr.Tumblr import new [as 别名]
def test_new_with_blog_name(self):
self.auth_entity.user_json = json.dumps({
'user': {'blogs': [{'url': 'foo'},
{'name': 'bar', 'url': 'baz'},
{'name': 'biff', 'url': 'http://boff/'},
]}})
got = Tumblr.new(self.handler, auth_entity=self.auth_entity, blog_name='biff')
self.assertEquals(['http://boff/'], got.domain_urls)
self.assertEquals(['boff'], got.domains)
示例5: test_verify
# 需要导入模块: from tumblr import Tumblr [as 别名]
# 或者: from tumblr.Tumblr import new [as 别名]
def test_verify(self):
# based on http://snarfed.tumblr.com/
# this requests.get is called by webmention-tools
self.expect_requests_get('http://primary/', """
<html><body>
some stuff
<script charset="utf-8" type="text/javascript" src="http://disqus.com/forums/my-disqus-name/get_num_replies.js?url131=...&"></script>
</body></html>""", verify=False)
self.mox.ReplayAll()
t = Tumblr.new(self.handler, auth_entity=self.auth_entity, features=['webmention'])
t.verify()
self.assertEquals('my-disqus-name', t.disqus_shortname)
示例6: test_new_no_primary_blog
# 需要导入模块: from tumblr import Tumblr [as 别名]
# 或者: from tumblr.Tumblr import new [as 别名]
def test_new_no_primary_blog(self):
self.auth_entity.user_json = json.dumps({'user': {'blogs': [{'url': 'foo'}]}})
self.assertIsNone(Tumblr.new(self.handler, auth_entity=self.auth_entity))
self.assertIn('Tumblr blog not found', next(iter(self.handler.messages)))