本文整理汇总了Python中djangodav.views.DavView.propfind方法的典型用法代码示例。如果您正苦于以下问题:Python DavView.propfind方法的具体用法?Python DavView.propfind怎么用?Python DavView.propfind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类djangodav.views.DavView
的用法示例。
在下文中一共展示了DavView.propfind方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_propfind_all_names
# 需要导入模块: from djangodav.views import DavView [as 别名]
# 或者: from djangodav.views.DavView import propfind [as 别名]
def test_propfind_all_names(self):
self.sub_object.get_descendants.return_value += [self.sub_object]
request = Mock(META={})
path = 'collection/sub_object'
v = DavView(base_url='/base/', path=path, request=request, acl_class=FullAcl, xml_pretty_print=True)
v.__dict__['resource'] = self.sub_object
resp = v.propfind(request, path,
etree.XPathDocumentEvaluator(ElementTree(
D.propfind(
D.propname()
)
), namespaces=WEBDAV_NSMAP)
)
self.assertEqual(resp.status_code, 207)
self.assertEqual(resp.content,
etree.tostring(D.multistatus(
D.response(
D.href('/base/collection/sub_object'),
D.propstat(
D.prop(
D.getcontentlength(),
D.creationdate(),
D.getlastmodified(),
D.resourcetype(),
D.displayname(),
),
D.status("HTTP/1.1 200 OK")
)
),
), pretty_print=True, xml_declaration=True, encoding='utf-8')
)
示例2: test_propfind_listing
# 需要导入模块: from djangodav.views import DavView [as 别名]
# 或者: from djangodav.views.DavView import propfind [as 别名]
def test_propfind_listing(self):
self.top_collection.get_descendants.return_value += [self.top_collection]
request = Mock(META={})
path = '/collection/'
v = DavView(base_url='/base/', path=path, request=request, acl_class=FullAcl, xml_pretty_print=True)
v.__dict__['resource'] = self.top_collection
resp = v.propfind(request, path, None)
self.assertEqual(resp.status_code, 207)
self.assertEqual(resp.content,
etree.tostring(D.multistatus(
D.response(
D.href('/base/collection/sub_object'),
D.propstat(
D.prop(
D.getcontentlength("42"),
D.creationdate("1983-12-24T06:00:00Z"),
D.getlastmodified("Wed, 24 Dec 2014 06:00:00 +0000"),
D.resourcetype(),
D.displayname("sub_object"),
),
D.status("HTTP/1.1 200 OK")
)
),
D.response(
D.href('/base/collection/sub_colection/'),
D.propstat(
D.prop(
D.getcontentlength("0"),
D.creationdate("1983-12-24T06:00:00Z"),
D.getlastmodified("Wed, 24 Dec 2014 06:00:00 +0000"),
D.resourcetype(D.collection()),
D.displayname("sub_colection"),
),
D.status("HTTP/1.1 200 OK")
)
),
D.response(
D.href('/base/collection/'),
D.propstat(
D.prop(
D.getcontentlength("0"),
D.creationdate("1983-12-24T06:00:00Z"),
D.getlastmodified("Wed, 24 Dec 2014 06:00:00 +0000"),
D.resourcetype(D.collection()),
D.displayname("collection"),
),
D.status("HTTP/1.1 200 OK")
)
),
), pretty_print=True, xml_declaration=True, encoding='utf-8')
)