def testSectionDictWithDefaultSection(self): file = StringIO.StringIO(self.VALID_CONFIG_DEFAULT_ONLY) usercfg = UserConfigurator(file) values = usercfg.getSectionDict('default') self.assertEqual(len(values), 3) self.assertEqual(values['endpoint'], '<cloud.frontend.hostname>') self.assertEqual(values['username'], '<username>') self.assertEqual(values['password'], '<password>')
def testSectionDictWithNonexistentSection(self): file = StringIO.StringIO(self.VALID_CONFIG_DEFAULT_ONLY) usercfg = UserConfigurator(file) values = usercfg.getSectionDict('non-existent-section') self.assertEqual(len(values), 0)
def testSectionDictWithNoArgument(self): file = StringIO.StringIO(self.VALID_CONFIG_DEFAULT_ONLY) usercfg = UserConfigurator(file) values = usercfg.getSectionDict() self.assertEqual(len(values), 0)