Esempio n. 1
0
    def _init_test(self, value):
        # Init data
        if not lfs.exists(self.config_path):
            lfs.make_file(self.config_path)

        # Write data
        config = ConfigFile(self.config_path)
        config.set_value("test", value)
        config.save_state()
Esempio n. 2
0
    def test_wrapped_quote_value(self):
        # Init data
        value = "\"HELLO, WORLD!\""
        self._init_test(value)

        # Write data
        config = ConfigFile(self.config_path)
        try:
            config.set_value("test", value)
        except SyntaxError, e:
            self.fail(e)
Esempio n. 3
0
    def test_last_line_empty(self):
        # Init data
        value = "HELLO, WORLD!\n\n"
        self._init_test(value)

        # Write data
        config = ConfigFile(self.config_path)
        config.set_value("test", value)
        config.save_state()

        # Read data
        config2 = ConfigFile(self.config_path)
        config2_value = config2.get_value("test")
        lfs.remove(self.config_path)

        # Test data
        self.assertEqual(config2_value, value)