def test_getPropertyDefaultValue(self): """ Test OvfProperty.getPropertyDefaultValue """ ovfFileName = self.path+"/"+self.ovf ovfFile = OvfFile(ovfFileName) # Get all property nodes in the ovf propertyNodes = Ovf.getNodes(ovfFile.envelope, (Ovf.hasTagName, 'Property')) # The first (hostname) property is the one we want to test with testNode = propertyNodes[0] # Test no default specified value = OvfProperty.getPropertyDefaultValue(testNode, None) assert value == None, "failed no default test" # The seventh (httpPort) property is the one we want to test with testNode = propertyNodes[6] # Test default specified as attribute value = OvfProperty.getPropertyDefaultValue(testNode, None) assert value == '80', "failed attribute test" # The ninth (startThreads) property is the one we want to test with testNode = propertyNodes[8] # Test default specified as default configuration value = OvfProperty.getPropertyDefaultValue(testNode, None) assert value == '50', "failed attribute test" # Using the same property node # Test default specified for given configuration value = OvfProperty.getPropertyDefaultValue(testNode, 'Minimal') assert value == '10', "failed config test"