本文整理汇总了Python中model.Entry.has_media方法的典型用法代码示例。如果您正苦于以下问题:Python Entry.has_media方法的具体用法?Python Entry.has_media怎么用?Python Entry.has_media使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.Entry
的用法示例。
在下文中一共展示了Entry.has_media方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get
# 需要导入模块: from model import Entry [as 别名]
# 或者: from model.Entry import has_media [as 别名]
def test_get(self):
context = Context(http=MockHttp(HTTP_SRC_DIR), entry="http://example.org/entry/67")
entry = Entry(context)
(headers, body) = entry.get()
self.assertEqual(200, headers.status)
self.assertFalse(entry.has_media())
self.assertEqual(entry.uri(), "http://example.org/entry/67")
示例2: test_put
# 需要导入模块: from model import Entry [as 别名]
# 或者: from model.Entry import has_media [as 别名]
def test_put(self):
context = Context(http=MockHttp(HTTP_SRC_DIR), entry="http://example.org/entry/67")
entry = Entry(context)
(headers, body) = entry.put(body="<entry></entry>")
self.assertEqual(200, headers.status)
self.assertFalse(entry.has_media())
self.assertEqual(0, len(body))
示例3: test_put_media
# 需要导入模块: from model import Entry [as 别名]
# 或者: from model.Entry import has_media [as 别名]
def test_put_media(self):
context = Context(http=MockHttp(HTTP_SRC_DIR), entry="http://example.org/images/77")
entry = Entry(context)
(headers, body) = entry.get()
self.assertEqual(200, headers.status)
self.assertTrue(entry.has_media())
(headers, body) = entry.put_media(headers={}, body="")
self.assertEqual(202, headers.status) # We don't really expect 202 from a PUT, just testing.
示例4: test_get_media
# 需要导入模块: from model import Entry [as 别名]
# 或者: from model.Entry import has_media [as 别名]
def test_get_media(self):
context = Context(http=MockHttp(HTTP_SRC_DIR), entry="http://example.org/images/77")
entry = Entry(context)
(headers, body) = entry.get()
self.assertEqual(200, headers.status)
self.assertTrue(entry.has_media())
(headers, body) = entry.get_media()
self.assertEqual(200, headers.status)
self.assertTrue(headers["content-type"], "image/jpg")
self.assertEqual(7483, len(body))