Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 3
0
 def test_toml_advanced(self):
     config = Config('')
     config.from_toml(self.example_prefix('advanced.toml'))
     self.advanced_test(config)
Ejemplo n.º 4
0
 def test_toml_basic(self):
     config = Config('')
     config.from_toml(self.example_prefix('basic.toml'))
     self.basic_test(config)
Ejemplo n.º 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)
Ejemplo n.º 6
0
 def test_toml_advanced(self):
     config = Config('')
     config.from_toml(self.example_prefix('advanced.toml'))
     self.advanced_test(config)
Ejemplo n.º 7
0
 def test_toml_basic(self):
     config = Config('')
     config.from_toml(self.example_prefix('basic.toml'))
     self.basic_test(config)
Ejemplo n.º 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)