1
|
|
|
#!/usr/bin/env python3 |
2
|
|
|
# -*- coding: utf-8 -*- |
3
|
|
|
|
4
|
|
|
"""Module documentation goes here.""" |
5
|
|
|
|
6
|
|
|
import unittest |
7
|
|
|
import os |
|
|
|
|
8
|
|
|
from src.things3 import Things3 |
9
|
|
|
|
10
|
|
|
class Things3Case(unittest.TestCase): |
11
|
|
|
"""Class documentation goes here.""" |
12
|
|
|
|
|
|
|
|
13
|
|
|
things3 = Things3(database = 'tests/Things.sqlite3') |
|
|
|
|
14
|
|
|
|
15
|
|
|
def test_today(self): |
16
|
|
|
"""Test Today.""" |
17
|
|
|
tasks = self.things3.get_today() |
18
|
|
|
self.assertEqual(1, len(tasks), "foo") |
19
|
|
|
|
20
|
|
|
def test_inbox(self): |
21
|
|
|
"""Test Inbox.""" |
22
|
|
|
tasks = self.things3.get_inbox() |
23
|
|
|
self.assertEqual(1, len(tasks)) |
24
|
|
|
|
|
|
|
|
25
|
|
|
def test_next(self): |
26
|
|
|
"""Test Next.""" |
27
|
|
|
tasks = self.things3.get_anytime() |
28
|
|
|
self.assertEqual(4, len(tasks)) |
29
|
|
|
|
30
|
|
|
def test_backlog(self): |
31
|
|
|
"""Test Backlog.""" |
32
|
|
|
tasks = self.things3.get_someday() |
33
|
|
|
self.assertEqual(1, len(tasks)) |
34
|
|
|
|
|
|
|
|
35
|
|
|
def test_upcoming(self): |
36
|
|
|
"""Test Upcoming.""" |
37
|
|
|
tasks = self.things3.get_upcoming() |
38
|
|
|
self.assertEqual(3, len(tasks)) |
39
|
|
|
|
|
|
|
|
40
|
|
|
def test_waiting(self): |
41
|
|
|
"""Test Waiting.""" |
42
|
|
|
tasks = self.things3.get_waiting() |
43
|
|
|
self.assertEqual(1, len(tasks)) |
44
|
|
|
|
|
|
|
|
45
|
|
|
def test_mit(self): |
46
|
|
|
"""Test MIT.""" |
47
|
|
|
tasks = self.things3.get_mit() |
48
|
|
|
self.assertEqual(0, len(tasks)) |
49
|
|
|
|
50
|
|
|
def test_completed(self): |
51
|
|
|
"""Test completed tasks.""" |
52
|
|
|
tasks = self.things3.get_completed() |
53
|
|
|
self.assertEqual(1, len(tasks)) |
54
|
|
|
|
55
|
|
|
def test_cancelled(self): |
56
|
|
|
"""Test cancelled tasks.""" |
57
|
|
|
tasks = self.things3.get_cancelled() |
58
|
|
|
self.assertEqual(1, len(tasks)) |
59
|
|
|
|
60
|
|
|
def test_trashed(self): |
61
|
|
|
"""Test trashed tasks.""" |
62
|
|
|
tasks = self.things3.get_trashed() |
63
|
|
|
self.assertEqual(3, len(tasks)) |
64
|
|
|
|
65
|
|
|
def test_all(self): |
66
|
|
|
"""Test all tasks.""" |
67
|
|
|
tasks = self.things3.get_all() |
68
|
|
|
self.assertEqual(13, len(tasks)) |
69
|
|
|
|
70
|
|
|
def test_due(self): |
71
|
|
|
"""Test due tasks.""" |
72
|
|
|
tasks = self.things3.get_due() |
73
|
|
|
self.assertEqual(1, len(tasks)) |
74
|
|
|
|
75
|
|
|
if __name__ == '__main__': |
76
|
|
|
unittest.main() |
77
|
|
|
|