Пример #1
0
    def testWithSection(self):
        file = StringIO.StringIO(self.VALID_CONFIG_WITH_SECTION)
        configurator = UserConfigurator(file)
        dict = configurator.getDict()
        self.assertEqual(dict['username'], '<username>')

        dict = configurator.getDict("my-section")        
        self.assertEqual(dict['username'], '<another.username>')
Пример #2
0
 def testWithSectionAndReference(self):
     file = StringIO.StringIO(self.VALID_CONFIG_WITH_SECTION_AND_REFERENCE)
     configurator = UserConfigurator(file)
     dict = configurator.getDict()
     self.assertEqual(dict['username'], '<another.username>')
Пример #3
0
 def testDefaultInstanceTypeWithConfigAttribute(self):
     file = StringIO.StringIO(self.VALID_CONFIG_DEFAULT_ONLY_WITH_INSTANCE_TYPE)
     usercfg = UserConfigurator(file)
     dict = usercfg.getDict()
     self.assertEqual(dict['default_instance_type'], 'my.type')
Пример #4
0
 def testDefaultOnly(self):
     file = StringIO.StringIO(self.VALID_CONFIG_DEFAULT_ONLY)
     configurator = UserConfigurator(file)
     dict = configurator.getDict()
     self.assertEqual(dict['username'], '<username>')
Пример #5
0
 def testDefaultInstanceTypeWithoutConfigAttribute(self):
     file = StringIO.StringIO(self.VALID_CONFIG_DEFAULT_ONLY)
     usercfg = UserConfigurator(file)
     dict = usercfg.getDict()
     self.assertFalse('default_instance_type' in dict.keys())