def testStaticEDConfiguration(self): # This test make sure that changing an instatiation of EDConfiguration does not change the # corresponding plugin configuration for EDConfigurationStatic strPathToTestConfigFile = os.path.join(self.strDataPath, "XSConfiguration_testNonStatic.xml") edConfiguration = EDConfiguration(strPathToTestConfigFile) strParam1 = edConfiguration.getStringValue("EDPluginTestPluginFactory", "testItemName") EDUtilsPath.setEdnaSite("TestStaticConfiguration") strParam2 = EDConfigurationStatic.getStringValue("EDPluginTestPluginFactory", "testItemName") EDAssert.equal(False, strParam1 == strParam2, "Static config is not equal to local config")
def testGetPathToProjectConfigurationFile(self): edConfiguration = EDConfiguration() strPathToConfigurationFile1 = edConfiguration.getPathToProjectConfigurationFile("EDPluginTestPluginFactory") strPathToConfigurationFileReference1 = EDUtilsPath.appendListOfPaths(EDUtilsPath.getEdnaHome(), [ "kernel", "tests", "data", "EDFactoryPlugin", \ "testProject", "conf", "XSConfiguration_TestSite.xml" ]) EDAssert.equal(strPathToConfigurationFileReference1, strPathToConfigurationFile1) EDUtilsPath.setEdnaSite("NonexistingTestSite") strPathToConfigurationFile2 = edConfiguration.getPathToProjectConfigurationFile("EDPluginTestPluginFactory") strPathToConfigurationFileReference2 = None EDAssert.equal(strPathToConfigurationFileReference2, strPathToConfigurationFile2)
def testStaticEDConfiguration(self): # This test make sure that changing an instatiation of EDConfiguration does not change the # corresponding plugin configuration for EDConfigurationStatic strPathToTestConfigFile = os.path.join( self.strDataPath, "XSConfiguration_testNonStatic.xml") edConfiguration = EDConfiguration(strPathToTestConfigFile) strParam1 = edConfiguration.getStringValue("EDPluginTestPluginFactory", "testItemName") EDUtilsPath.setEdnaSite("TestStaticConfiguration") strParam2 = EDConfigurationStatic.getStringValue( "EDPluginTestPluginFactory", "testItemName") EDAssert.equal(False, strParam1 == strParam2, "Static config is not equal to local config")
def testGetPathToProjectConfigurationFile(self): edConfiguration = EDConfiguration() strPathToConfigurationFile1 = edConfiguration.getPathToProjectConfigurationFile( "EDPluginTestPluginFactory") strPathToConfigurationFileReference1 = EDUtilsPath.appendListOfPaths(EDUtilsPath.getEdnaHome(), [ "kernel", "tests", "data", "EDFactoryPlugin", \ "testProject", "conf", "XSConfiguration_TestSite.xml" ]) EDAssert.equal(strPathToConfigurationFileReference1, strPathToConfigurationFile1) EDUtilsPath.setEdnaSite("NonexistingTestSite") strPathToConfigurationFile2 = edConfiguration.getPathToProjectConfigurationFile( "EDPluginTestPluginFactory") strPathToConfigurationFileReference2 = None EDAssert.equal(strPathToConfigurationFileReference2, strPathToConfigurationFile2)
def testGetPathToProjectConfigurationFile(self): EDUtilsPath.setEdnaSite("TestSite") edFactoryPlugin = EDFactoryPlugin() strPathToConfigurationFile1 = edFactoryPlugin.getPathToProjectConfigurationFile("EDPluginTestPluginFactory") strPathToConfigurationFileReference1 = EDUtilsPath.appendListOfPaths(EDUtilsPath.getEdnaHome(), [ "edna-kernel", "tests", "data", "EDFactoryPlugin", \ "testProject", "conf", "XSConfiguration_TestSite.xml" ]) EDAssert.equal(strPathToConfigurationFileReference1, strPathToConfigurationFile1) EDUtilsPath.setEdnaSite("NonexistingTestSite") strPathToConfigurationFile2 = edFactoryPlugin.getPathToProjectConfigurationFile("EDPluginTestPluginFactory") strPathToConfigurationFileReference2 = None EDAssert.equal(strPathToConfigurationFileReference2, strPathToConfigurationFile2) # Since this is a static variable we need to reset it to None in order not to break any other tests... EDUtilsPath.setEdnaSite(None)
def preProcess(self): """Set EDNA_SITE to TestSite for these tests""" EDUtilsPath.setEdnaSite("TestSite")
def finallyProcess(self): """Restores EDNA_SITE""" EDUtilsPath.setEdnaSite(self.strEdnaSiteOrig)