예제 #1
0
    def test_save_load(self):
        name = "test2"
        tsk1 = task.Task("Do something", 1367144289 , 0)
        tsk2 = task.Task("Do something else", 1367144288 , 0)
        tsk3 = task.Task("A completed task", 13671442887, 0)

        before = TaskList(name, self.workingD)
        before.add(tsk1)
        before.add(tsk2)

        before.add(tsk3)
        before.complete(2)

        before.save()

        after = TaskList(name, self.workingD)
        assert after.active() == 2
        assert after.completed() == 1
        
        assert after.activetasks[0].equals(before.activetasks[0])
        assert after.activetasks[1].equals(before.activetasks[1])

        assert after.completedtasks[0].equals(before.completedtasks[0])

        before.destroy()
예제 #2
0
    def test_create_destroy(self):
        name = "test1"

        tl = TaskList(name, self.workingD)
        tl.save()

        assert os.path.exists(os.path.join(self.workingD, name + ".tsk"))

        tl.destroy()

        assert not os.path.exists(os.path.join(self.workingD, name + ".tsk"))