def test_clear_properties(self): # Add a new property node = Node(ElementTree.fromstring(NODE_XML)) node.set_property('quota', '1000') properties = node.node.find(Node.PROPERTIES) property_list = properties.findall(Node.PROPERTY) self.assertTrue(len(property_list) >= 1) # Clear the property node.clear_properties() properties = node.node.find(Node.PROPERTIES) property_list = properties.findall(Node.PROPERTY) self.assertTrue(len(property_list) == 0)
def test_node_set_property(self): node = Node(ElementTree.fromstring(NODE_XML)) properties = node.node.find(Node.PROPERTIES) property_list = properties.findall(Node.PROPERTY) self.assertEqual(len(property_list), 1) node.set_property('key', 'value') properties = node.node.find(Node.PROPERTIES) property_list = properties.findall(Node.PROPERTY) self.assertEqual(len(property_list), 2) found = False for prop in property_list: uri = prop.get('uri') if uri.endswith('key'): found = True self.assertTrue(found)