예제 #1
0
    def test_unvalid_type_int(self):
        files_name = '03_unvalid_type'
        definition = yaml.load( open(path.join(here, 'input', files_name + '_int.def.yml')) )
        config = yaml.load( open(path.join(here, 'input', files_name + '.yml')) )

        with self.assertRaises(ValueError):
            defconf.validate_config( config, definition, files_name )
예제 #2
0
    def test_incorrect_values_list(self):
        files_name = '04_incorrect_values_list'
        definition = yaml.load( open(path.join(here, 'input', files_name + '.def.yml')) )
        config = yaml.load( open(path.join(here, 'input', files_name + '.yml')) )

        with self.assertRaises(ValueError):
            defconf.validate_config( config, definition, files_name )
예제 #3
0
    def test_undefined_element(self):
        files_name = '02_undefined_element'
        definition = yaml.load( open(path.join(here, 'input', files_name + '.def.yml')) )
        config = yaml.load( open(path.join(here, 'input', files_name + '.yml')) )

        with self.assertRaises(IndexError):
            defconf.validate_config( config, definition, files_name )
예제 #4
0
    def test_undefined_element_accept_all(self):
        files_name = '02_undefined_element_accept_all'
        definition = yaml.load( open(path.join(here, 'input', files_name + '.def.yml')) )
        config = yaml.load( open(path.join(here, 'input', files_name + '.yml')) )

        defconf.validate_config( config, definition, files_name )
        self.assertTrue(1)
예제 #5
0
    def test_all_good(self):
        files_name = '01_all_good'
        definition = yaml.load( open(path.join(here, 'input', files_name + '.def.yml')) )
        config = yaml.load( open(path.join(here, 'input', files_name + '.yml')) )

        defconf.validate_config( config, definition, files_name )
        self.assertTrue(1)
예제 #6
0
    def test_nested_dict_wit_star(self):
        files_name = '07_nested_dict_with_star'
        definition = yaml.load( open(path.join(here, 'input', files_name + '.def.yml')) )
        config = yaml.load( open(path.join(here, 'input', files_name + '.yml')) )

        defconf.validate_config( config, definition, files_name )
        ##
        self.assertTrue( 1 )
예제 #7
0
    def test_unvalid_type_int(self):
        files_name = '03_unvalid_type'
        definition = yaml.load(
            open(path.join(here, 'input', files_name + '_int.def.yml')))
        config = yaml.load(open(path.join(here, 'input', files_name + '.yml')))

        with self.assertRaises(ValueError):
            defconf.validate_config(config, definition, files_name)
예제 #8
0
    def test_incorrect_values_list(self):
        files_name = '04_incorrect_values_list'
        definition = yaml.load(
            open(path.join(here, 'input', files_name + '.def.yml')))
        config = yaml.load(open(path.join(here, 'input', files_name + '.yml')))

        with self.assertRaises(ValueError):
            defconf.validate_config(config, definition, files_name)
예제 #9
0
    def test_undefined_element_accept_all(self):
        files_name = '02_undefined_element_accept_all'
        definition = yaml.load(
            open(path.join(here, 'input', files_name + '.def.yml')))
        config = yaml.load(open(path.join(here, 'input', files_name + '.yml')))

        defconf.validate_config(config, definition, files_name)
        self.assertTrue(1)
예제 #10
0
    def test_undefined_element(self):
        files_name = '02_undefined_element'
        definition = yaml.load(
            open(path.join(here, 'input', files_name + '.def.yml')))
        config = yaml.load(open(path.join(here, 'input', files_name + '.yml')))

        with self.assertRaises(IndexError):
            defconf.validate_config(config, definition, files_name)
예제 #11
0
    def test_all_good(self):
        files_name = '01_all_good'
        definition = yaml.load(
            open(path.join(here, 'input', files_name + '.def.yml')))
        config = yaml.load(open(path.join(here, 'input', files_name + '.yml')))

        defconf.validate_config(config, definition, files_name)
        self.assertTrue(1)
예제 #12
0
    def test_nested_dict_wit_star(self):
        files_name = '07_nested_dict_with_star'
        definition = yaml.load(
            open(path.join(here, 'input', files_name + '.def.yml')))
        config = yaml.load(open(path.join(here, 'input', files_name + '.yml')))

        defconf.validate_config(config, definition, files_name)
        ##
        self.assertTrue(1)
예제 #13
0
    def test_default_values(self):
        files_name = '06_default_values'
        definition = yaml.load( open(path.join(here, 'input', files_name + '.def.yml')) )
        config = yaml.load( open(path.join(here, 'input', files_name + '.yml')) )

        defconf.validate_config( config, definition, files_name )

        ##
        self.assertTrue( config.has_key('mail_servers_ports') )
        self.assertTrue( config['mail_servers_ports'] == 25 )

        self.assertTrue( config['database'].has_key('login') )
        self.assertTrue( config['database']['login'] == 'admin' )
예제 #14
0
    def test_default_values(self):
        files_name = '06_default_values'
        definition = yaml.load(
            open(path.join(here, 'input', files_name + '.def.yml')))
        config = yaml.load(open(path.join(here, 'input', files_name + '.yml')))

        defconf.validate_config(config, definition, files_name)

        ##
        self.assertTrue(config.has_key('mail_servers_ports'))
        self.assertTrue(config['mail_servers_ports'] == 25)

        self.assertTrue(config['database'].has_key('login'))
        self.assertTrue(config['database']['login'] == 'admin')