Exemplo n.º 1
0
    def test_create_proppatch_remove(self):
        """Test WebDAVClient._create_proppatch: remove property"""
        # remove only
        delprops = ["DEL:xxx"]
        ns = {"DEL": "DEL:"}
        xml = creator.create_proppatch(None, delprops, ns)

        assert xml == b'<propertyupdate xmlns="DAV:" xmlns:DEL="DEL:">' \
            b'<remove>' \
            b'<prop><DEL:xxx /></prop>' \
            b'</remove>' \
            b'</propertyupdate>'
Exemplo n.º 2
0
 def test_create_proppatch_remove(self):
     """Test WebDAVClient._create_proppatch: remove property"""
     # remove only
     delprops = ["DEL:xxx"]
     ns = {"DEL": "DEL:"}
     xml = creator.create_proppatch(None, delprops, ns)
     self.assertEqual(xml, "<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n"
                           '<propertyupdate xmlns="DAV:" xmlns:DEL="DEL:">'
                           '<remove>'
                           '<prop><DEL:xxx /></prop>'
                           '</remove>'
                           '</propertyupdate>')
Exemplo n.º 3
0
 def test_create_proppatch_set(self):
     """Test WebDAVClient._create_proppatch: set property"""
     # set only
     setprops = {"CADN:author": "me", "CADN:created": "2009-09-09 13:31"}
     ns = {"CADN": "CADN:"}
     xml = creator.create_proppatch(setprops, None, ns)
     assert xml == b'<propertyupdate xmlns="DAV:" xmlns:CADN="CADN:">' \
                   b'<set>' \
                   b'<prop>' \
         b'<CADN:author>me</CADN:author>' \
         b'<CADN:created>2009-09-09 13:31</CADN:created>' \
                   b'</prop>' \
                   b'</set>' \
                   b'</propertyupdate>'
Exemplo n.º 4
0
 def test_create_proppatch_set(self):
     """Test WebDAVClient._create_proppatch: set property"""
     # set only
     setprops = {"CADN:author": "me", "CADN:created": "2009-09-09 13:31"}
     ns = {"CADN": "CADN:"}
     xml = creator.create_proppatch(setprops, None, ns)
     self.assertEqual(xml, "<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n"
                           '<propertyupdate xmlns="DAV:" xmlns:CADN="CADN:">'
                           '<set>'
                           '<prop>'
                           '<CADN:created>2009-09-09 13:31'
                           '<CADN:author>me</CADN:author>'
                           '</CADN:created>'
                           '</prop>'
                           '</set>'
                           '</propertyupdate>')
Exemplo n.º 5
0
 def test_create_proppatch_with_xml_element_as_propvalue(self):
     author_name = Element('name')
     author_name.text = 'me'
     author = Element('Z:author')
     author.append(author_name)
     setprops = {"Z:author": author}
     ns = {"CADN": "CADN:", "Z": "http://ns.example.com/Z"}
     xml = creator.create_proppatch(setprops, None, ns)
     if PYTHONVERSION >= (3, 0):
         assert xml == (
             b'<propertyupdate xmlns="DAV:" xmlns:CADN="CADN:" xmlns:Z="http://ns.example.com/Z">'
             b'<set><prop><Z:author><name>me</name></Z:author></prop></set>'
             b'</propertyupdate>')
     else:
         assert xml == (
             '<propertyupdate xmlns="DAV:" xmlns:CADN="CADN:" xmlns:Z="http://ns.example.com/Z">'
             '<set><prop><Z:author><name>me</name></Z:author></prop></set>'
             '</propertyupdate>')
Exemplo n.º 6
0
 def test_create_proppatch_setremove(self):
     """Test WebDAVClient._create_proppatch: set and remove property"""
     # set and del
     setprops = {"CADN:author": "me", "CADN:created": "2009-09-09 13:31"}
     delprops = ["DEL:xxx"]
     ns = {"CADN": "CADN:", "DEL": "DEL:"}
     xml = creator.create_proppatch(setprops, delprops, ns)
     assert xml == b'<propertyupdate xmlns="DAV:" xmlns:CADN="CADN:"' \
         b' xmlns:DEL="DEL:">' \
         b'<set>' \
         b'<prop>' \
         b'<CADN:author>me</CADN:author>' \
         b'<CADN:created>2009-09-09 13:31' \
         b'</CADN:created>' \
         b'</prop>' \
         b'</set>' \
         b'<remove>' \
         b'<prop><DEL:xxx /></prop>' \
         b'</remove>' \
         b'</propertyupdate>'
Exemplo n.º 7
0
 def test_create_proppatch_setremove(self):
     """Test WebDAVClient._create_proppatch: set and remove property"""
     # set and del
     setprops = {"CADN:author": "me", "CADN:created": "2009-09-09 13:31"}
     delprops = ["DEL:xxx"]
     ns = {"CADN": "CADN:", "DEL": "DEL:"}
     xml = creator.create_proppatch(setprops, delprops, ns)
     self.assertEqual(xml, "<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n"
                           '<propertyupdate xmlns="DAV:" xmlns:CADN="CADN:"'
                           ' xmlns:DEL="DEL:">'
                           '<set>'
                           '<prop>'
                           '<CADN:created>2009-09-09 13:31'
                           '<CADN:author>me</CADN:author>'
                           '</CADN:created>'
                           '</prop>'
                           '</set>'
                           '<remove>'
                           '<prop><DEL:xxx /></prop>'
                           '</remove>'
                           '</propertyupdate>')