Exemplo n.º 1
0
    def test_export(self):
        export_path = flask.current_app.config["EXPORT_PATH"]
        clean_tmp_export(export_path)

        librarian = Librarian(self.app)
        librarian.rotate_buffers()
        librarian.export_journal()

        self.assertEqual(len(glob.glob(os.path.join(export_path, "*"))), 6,
                         "correct number of directories created")
        self.assertEqual(
            len(glob.glob(os.path.join(export_path, "text", "*"))), 1,
            "correct number of text files created")
        self.assertEqual(
            len(glob.glob(os.path.join(export_path, "markdown", "*"))), 1,
            "correct number of markdown files created")

        clean_tmp_export(export_path)
Exemplo n.º 2
0
 def test_rotate(self):
     librarian = Librarian(self.app)
     librarian.rotate_buffers()
     self.assertEqual(Day.query.count(), 1, "1 day has been created")
     self.assertEqual(Entry.query.count(), 4, "4 entries have been created")