示例#1
0
    def environment_test(self, filename):
        config = Config('')
        config.from_toml(filename, environment='dev')

        assert config['TEST_KEY'] == 'foo'
        assert config['SECRET_KEY'] == 'devkey'
        assert config['DEBUG'] == True
        assert 'TESTING' not in config
        assert 'ignored' not in config

        config = Config('')
        config.from_toml(filename, environment='testing')
        assert config['TEST_KEY'] == 'foo'
        assert config['SECRET_KEY'] == 'devkey'
        assert config['TESTING'] == True
        assert 'DEBUG' not in config
        assert 'ignored' not in config
示例#2
0
    def environment_test(self, filename):
        config = Config('')
        config.from_toml(filename, environment='dev')

        assert config['TEST_KEY'] == 'foo'
        assert config['SECRET_KEY'] == 'devkey'
        assert config['DEBUG'] == True
        assert 'TESTING' not in config
        assert 'ignored' not in config

        config = Config('')
        config.from_toml(filename, environment='testing')
        assert config['TEST_KEY'] == 'foo'
        assert config['SECRET_KEY'] == 'devkey'
        assert config['TESTING'] == True
        assert 'DEBUG' not in config
        assert 'ignored' not in config
示例#3
0
 def test_toml_advanced(self):
     config = Config('')
     config.from_toml(self.example_prefix('advanced.toml'))
     self.advanced_test(config)
示例#4
0
 def test_toml_basic(self):
     config = Config('')
     config.from_toml(self.example_prefix('basic.toml'))
     self.basic_test(config)
示例#5
0
 def test_toml_format_error(self):
     with pytest.raises(toml.TomlError):
         example = self.example_prefix('format_err.toml')
         config = Config('')
         config.from_toml(example)
示例#6
0
 def test_toml_advanced(self):
     config = Config('')
     config.from_toml(self.example_prefix('advanced.toml'))
     self.advanced_test(config)
示例#7
0
 def test_toml_basic(self):
     config = Config('')
     config.from_toml(self.example_prefix('basic.toml'))
     self.basic_test(config)
示例#8
0
 def test_toml_format_error(self):
     with pytest.raises(toml.TomlError):
         example = self.example_prefix('format_err.toml')
         config = Config('')
         config.from_toml(example)