Esempio n. 1
0
    def test_new_file(self):
        """
        test adding new trasaction line to an empty (non-existing) file
        """
        store = MockHistStore(path.join(self.temp_dir, "history.txt"))
        history = symstore.History(store)

        history.add("new_line")

        self.assertFileContents(store._history_file,
                                "new_line")
Esempio n. 2
0
    def test_trailing_newline(self):
        """
        test adding new trasaction line to a history file
        with trailing newline character
        """
        store = MockHistStore(self._init_hist_file("trailing_newline.txt"))
        history = symstore.History(store)

        history.add("new_line")

        self.assertFileContents(store._history_file,
                                "original_line\nnew_line")