Exemplo n.º 1
0
def test_configparser_write_file_defaults(tmpdir):
    ccp = CallbackConfigParser(defaults={'foo': 'bar'})

    new_path = Path(tmpdir) / 'config_new.conf'
    ccp.write_file(new_path)

    assert new_path.is_file()
    ccp.read_file(new_path)
    assert ccp.get('DEFAULT', 'foo') == 'bar'
Exemplo n.º 2
0
    def test_configparser_write_file_defaults(self):
        ccp = CallbackConfigParser(defaults={'foo': 'bar'})

        new_path = self.session_base_dir / 'config_new.conf'
        ccp.write_file(new_path)

        self.assertTrue(new_path.is_file())
        ccp.read_file(new_path)
        self.assertEqual(ccp.get('DEFAULT', 'foo'), 'bar')
Exemplo n.º 3
0
def test_configparser_write_file(tmpdir):
    ccp = CallbackConfigParser()
    ccp.read_file(CONFIG_FILES_DIR / 'config1.conf')

    new_path = Path(tmpdir) / 'config_new.conf'
    ccp.write_file(new_path)

    assert new_path.is_file()
    ccp.read_file(new_path)

    assert ccp.get('general', 'version') == 11
    assert ccp.get('search_community', 'enabled')
    assert isinstance(ccp.get('tunnel_community', 'socks5_listen_ports'), list)
    assert not ccp.get('foo', 'bar')
Exemplo n.º 4
0
    def test_configparser_write_file(self):
        ccp = CallbackConfigParser()
        ccp.read_file(self.CONFIG_FILES_DIR / 'config1.conf')

        new_path = self.session_base_dir / 'config_new.conf'
        ccp.write_file(new_path)

        self.assertTrue(new_path.is_file())
        ccp.read_file(new_path)

        self.assertEqual(ccp.get('general', 'version'), 11)
        self.assertTrue(ccp.get('search_community', 'enabled'))
        self.assertIsInstance(ccp.get('tunnel_community', 'socks5_listen_ports'), list)
        self.assertFalse(ccp.get('foo', 'bar'))