def test_special_character(self):

        u = self.add_user()

        nb = Notebook(title="default", author=u)
        db.session.add(nb)
        db.session.commit()

        n = Note(title="5/14/3", body="test", notebook_id=nb.id, author=u)
        db.session.add(n)
        db.session.commit()

        e = Exporter(u)
        e.export()

        note_files = os.listdir("/tmp/{0}".format(u.id))
        expected_note_file = "5-14-3.md"

        self.assertTrue(expected_note_file in note_files)
Ejemplo n.º 2
0
    def test_special_character(self):

        u = self.add_user()

        nb = Notebook(title="default", author=u)
        db.session.add(nb)
        db.session.commit()

        n = Note(title="5/14/3", body="test", notebook_id=nb.id, author=u)
        db.session.add(n)
        db.session.commit()

        e = Exporter(u)
        e.export()

        note_files = os.listdir("/tmp/braindump-export/{0}".format(u.id))
        expected_note_file = "5-14-3.md"

        self.assertTrue(expected_note_file in note_files)
Ejemplo n.º 3
0
    def test_export_dir_created_when_not_exist(self):

        u = self.add_user()

        nb = Notebook(title="default", author=u)
        db.session.add(nb)
        db.session.commit()

        n = Note(title="5/14/3", body="test", notebook_id=nb.id, author=u)
        db.session.add(n)
        db.session.commit()

        # Create Two Exporter Instances
        e = Exporter(u)
        e2 = Exporter(u)

        e.export()
        e2.export()

        notebook_dir = os.listdir("/tmp/braindump-export")

        self.assertEqual(1, len(notebook_dir))
Ejemplo n.º 4
0
    def test_export_dir_created_when_not_exist(self):

        u = self.add_user()

        nb = Notebook(title="default", author=u)
        db.session.add(nb)
        db.session.commit()

        n = Note(title="5/14/3", body="test", notebook_id=nb.id, author=u)
        db.session.add(n)
        db.session.commit()

        # Create Two Exporter Instances
        e = Exporter(u)
        e2 = Exporter(u)

        e.export()
        e2.export()

        notebook_dir = os.listdir("/tmp/braindump-export")

        self.assertEqual(1, len(notebook_dir))
Ejemplo n.º 5
0
def export_notes():
    e = Exporter(current_user)
    e.export()
    return send_file(e.zip_file, as_attachment=True)
Ejemplo n.º 6
0
def export_notes():
    e = Exporter(current_user)
    e.export()
    return send_file(e.zip_file, as_attachment=True)