本文整理匯總了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))