def testConfigurationCreation(self):

        # Simulate the installation of the config file
        open(PolicyValidator.CONFIG, 'w').close()

        self._createConfiguration()

        policyCfg = ConfigHolder.parseConfig(PolicyValidator.CONFIG)
        
        sectionNames = ('endorsers', 
                        'images', 
                        'checksums')

        for sectionName in sectionNames:
            self.assertEqual('whitelist%(section)sv1, whitelist%(section)sv2' % {'section': sectionName}, 
                              policyCfg.get(sectionName, 'whitelist' + sectionName))
            self.assertEqual('blacklist%(section)sv1, blacklist%(section)sv2' % {'section': sectionName}, 
                              policyCfg.get(sectionName, 'blacklist' + sectionName))

        self.assertTrue(os.path.exists(PolicyValidator.CONFIG_SAV))
Exemple #2
0
 def parseConfig(self, configFileName):
     return ConfigHolder.parseConfig(configFileName)