Ejemplo 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")
Ejemplo 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")