Beispiel #1
0
 def testAddATodoWithADependant(self):
     chaido.addNewTodo(self.app, ["buy more milk"])
     chaido.addNewTodo(self.app,
                       ["go to the shops", "before", "buy more milk"])
     self.assertEqual(self.app.totalTodoCount, 2)
     self.assertEqual(self.app.getTodo(0), "go to the shops")
     self.assertEqual(self.app.visibleTodoCount, 1)
Beispiel #2
0
 def testAddNewTodoAtTheTopOfTheList(self):
     chaido.addNewTodo(self.app, ["write a book"])
     chaido.addNewTodo(self.app, ["buy more milk"])
     chaido.addNewTodoToTop(self.app, ["go to the shops"])
     self.assertEqual(self.app.totalTodoCount, 3)
     self.assertEqual(self.app.visibleTodoCount, 3)
     self.assertEqual(self.app.getTodo(0), "go to the shops")
     self.assertEqual(self.app.getTodo(1), "write a book")
     self.assertEqual(self.app.getTodo(2), "buy more milk")
Beispiel #3
0
 def testAddNewTodoAtTheTopOfTheList(self):
     chaido.addNewTodo(self.app, ["write a book"])
     chaido.addNewTodo(self.app, ["buy more milk"])
     chaido.addNewTodoToTop(self.app, ["go to the shops"])
     self.assertEqual(self.app.totalTodoCount, 3)
     self.assertEqual(self.app.visibleTodoCount, 3)
     self.assertEqual(self.app.getTodo(0), "go to the shops")
     self.assertEqual(self.app.getTodo(1), "write a book")
     self.assertEqual(self.app.getTodo(2), "buy more milk")
Beispiel #4
0
 def testAddMultipleTodoWithASpecifiedWithIndex(self):
     chaido.addNewTodo(self.app, ["write a book"])
     chaido.addNewTodo(self.app, ["buy more milk"])
     chaido.addNewTodo(self.app, ["go to the shops", "before", "1", "2"])
     self.assertEqual(self.app.totalTodoCount, 3)
     self.assertEqual(self.app.visibleTodoCount, 1)
     self.assertEqual(self.app.getTodo(0), "go to the shops")
Beispiel #5
0
    def testListingAllTasks(self):
        self.app = MockChaiDoApp()
        chaido.addNewTodo(self.app, ["buy pens"])
        chaido.addNewTodo(self.app, ["buy more milk"])
        chaido.addNewTodo(self.app, ["write a book"])
        chaido.addNewTodo(self.app, ["go to the shops"])
        chaido.setTaskAsDependant(self.app, ["4", "before", "1"])
        self.assertEqual(chaido.listToDos(self.app, []), """1: buy more milk
2: write a book
3: go to the shops""")
        self.assertEqual(chaido.listAllToDos(self.app, []), """buy pens
buy more milk
write a book
go to the shops""")
Beispiel #6
0
 def testAddMultipleTodoWithASpecifiedWithIndex(self):
     chaido.addNewTodo(self.app, ["write a book"])
     chaido.addNewTodo(self.app, ["buy more milk"])
     chaido.addNewTodo(self.app, ["go to the shops", "before", "1", "2"])
     self.assertEqual(self.app.totalTodoCount, 3)
     self.assertEqual(self.app.visibleTodoCount, 1)
     self.assertEqual(self.app.getTodo(0), "go to the shops")
Beispiel #7
0
    def testListingAllTasks(self):
        self.app = MockChaiDoApp()
        chaido.addNewTodo(self.app, ["buy pens"])
        chaido.addNewTodo(self.app, ["buy more milk"])
        chaido.addNewTodo(self.app, ["write a book"])
        chaido.addNewTodo(self.app, ["go to the shops"])
        chaido.setTaskAsDependant(self.app, ["4", "before", "1"])
        self.assertEqual(
            chaido.listToDos(self.app, []), """1: buy more milk
2: write a book
3: go to the shops""")
        self.assertEqual(
            chaido.listAllToDos(self.app, []), """buy pens
buy more milk
write a book
go to the shops""")
Beispiel #8
0
    def testRemovingMultipleTasksInNonDecreasingOrder(self):
        chaido.addNewTodo(self.app, ["buy more cheese"])
        chaido.addNewTodo(self.app, ["buy more eggs"])
        chaido.addNewTodo(self.app, ["buy more flour"])
        self.assertEqual(self.app.visibleTodoCount, 4)
        self.assertEqual(self.app.totalTodoCount, 5)
        self.assertEqual(self.app.getTodo(0), "go to the shops")
        self.assertEqual(self.app.getTodo(1), "buy more cheese")
        self.assertEqual(self.app.getTodo(2), "buy more eggs")
        self.assertEqual(self.app.getTodo(3), "buy more flour")

        chaido.removeTodo(self.app, ["1", "2", "3"])
        self.assertEqual(self.app.visibleTodoCount, 2)
        self.assertEqual(self.app.totalTodoCount, 2)
        self.assertEqual(self.app.getTodo(0), "buy more milk")
        self.assertEqual(self.app.getTodo(1), "buy more flour")
Beispiel #9
0
    def testRemovingMultipleTasksInNonDecreasingOrder(self):
        chaido.addNewTodo(self.app, ["buy more cheese"])
        chaido.addNewTodo(self.app, ["buy more eggs"])
        chaido.addNewTodo(self.app, ["buy more flour"])
        self.assertEqual(self.app.visibleTodoCount, 4)
        self.assertEqual(self.app.totalTodoCount, 5)
        self.assertEqual(self.app.getTodo(0), "go to the shops")
        self.assertEqual(self.app.getTodo(1), "buy more cheese")
        self.assertEqual(self.app.getTodo(2), "buy more eggs")
        self.assertEqual(self.app.getTodo(3), "buy more flour")

        chaido.removeTodo(self.app, ["1", "2", "3"])
        self.assertEqual(self.app.visibleTodoCount, 2)
        self.assertEqual(self.app.totalTodoCount, 2)
        self.assertEqual(self.app.getTodo(0), "buy more milk")
        self.assertEqual(self.app.getTodo(1), "buy more flour")
Beispiel #10
0
 def setUp(self):
     self.app = MockChaiDoApp()
     chaido.addNewTodo(self.app, ["buy more milk"])
     chaido.addNewTodo(self.app,
                       ["go to the shops", "before", "buy more milk"])
Beispiel #11
0
 def setUp(self):
     self.app = MockChaiDoApp()
     chaido.addNewTodo(self.app, ["buy pens"])
     chaido.addNewTodo(self.app, ["buy more milk"])
     chaido.addNewTodo(self.app, ["write a book"])
     chaido.addNewTodo(self.app, ["go to the shops"])
Beispiel #12
0
 def testAddATodo(self):
     chaido.addNewTodo(self.app, ["buy more milk"])
     self.assertEqual(self.app.totalTodoCount, 1)
     self.assertEqual(self.app.getTodo(0), "buy more milk")
Beispiel #13
0
 def testAddATodo(self):
     chaido.addNewTodo(self.app, ["buy more milk"])
     self.assertEqual(self.app.totalTodoCount, 1)
     self.assertEqual(self.app.getTodo(0), "buy more milk")
Beispiel #14
0
 def testAddATodoWithADependant(self):
     chaido.addNewTodo(self.app, ["buy more milk"])
     chaido.addNewTodo(self.app, ["go to the shops", "before", "buy more milk"])
     self.assertEqual(self.app.totalTodoCount, 2)
     self.assertEqual(self.app.getTodo(0), "go to the shops")
     self.assertEqual(self.app.visibleTodoCount, 1)
Beispiel #15
0
 def setUp(self):
     self.app = MockChaiDoApp()
     chaido.addNewTodo(self.app, ["buy pens"])
     chaido.addNewTodo(self.app, ["buy more milk"])
     chaido.addNewTodo(self.app, ["write a book"])
     chaido.addNewTodo(self.app, ["go to the shops"])
Beispiel #16
0
    def testListingTwoTasks(self):
        expectedResult = """1: buy more milk
2: write a book"""
        self.assertEqual(chaido.listToDos(self.app, []), expectedResult)
        chaido.addNewTodo(self.app,
                          ["go to the shops", "before", "buy more milk"])
Beispiel #17
0
    def testListingTwoTasks(self):
        expectedResult = """1: buy more milk
2: write a book"""
        self.assertEqual(chaido.listToDos(self.app, []), expectedResult)
        chaido.addNewTodo(self.app, ["go to the shops", "before", "buy more milk"])
Beispiel #18
0
 def setUp(self):
     self.app = MockChaiDoApp()
     chaido.addNewTodo(self.app, ["buy more milk"])
     chaido.addNewTodo(self.app, ["go to the shops", "before", "buy more milk"])