示例#1
0
 def test_parse_xml_content_broken(self):
     """Test WebDAVResponse._parse_xml_content with broken XML."""
     response = Mock.Response()
     response.content = MULTISTATUS_BROKEN
     response.status = 207
     with replaced(WebDAVResponse, _parse_xml_content=Mock.omnivore_func()):
         davresponse = WebDAVResponse(response)
     davresponse._parse_xml_content()
     empty = davresponse._etree.getroot().getchildren()[0]
     assert empty.tag == "empty"
示例#2
0
 def test_parse_xml_content_broken(self):
     """Test WebDAVResponse._parse_xml_content with broken XML."""
     response = Mock.Response()
     response.content = MULTISTATUS_BROKEN
     response.status = 207
     with replaced(WebDAVResponse, _parse_xml_content=Mock.omnivore_func()):
         davresponse = WebDAVResponse(response)
     davresponse._parse_xml_content()
     empty = davresponse._etree.getroot().getchildren()[0]
     self.assertEquals(empty.tag, "empty")
示例#3
0
 def test_parse_xml_content(self):
     """Test WebDAVResponse._parse_xml_content."""
     response = Mock.Response()
     response.content = MULTISTATUS
     response.status = 207
     with replaced(WebDAVResponse, _parse_xml_content=Mock.omnivore_func()):
         davresponse = WebDAVResponse(response)
     davresponse._parse_xml_content()
     href = davresponse._etree.findtext("/{DAV:}response/{DAV:}href")
     self.assertEquals(href, "/3/38/38f/38fa476aa97a4b2baeb41a481fdca00b")
示例#4
0
 def test_parse_xml_content(self):
     """Test WebDAVResponse._parse_xml_content."""
     response = Mock.Response()
     if PYTHONVERSION >= (3, 0):
         # In Python3, HTTP Response.read() returns bytes, not str as in Python 2
         response.content = bytes(MULTISTATUS, 'utf-8')
     else:
         response.content = MULTISTATUS
     response.status = 207
     with replaced(WebDAVResponse, _parse_xml_content=Mock.omnivore_func()):
         davresponse = WebDAVResponse(response)
     davresponse._parse_xml_content()
     href = davresponse._etree.findtext("/{DAV:}response/{DAV:}href")
     assert href == "/3/38/38f/38fa476aa97a4b2baeb41a481fdca00b"