From: Rob Golding Date: Sun, 3 Nov 2013 20:41:03 +0000 (+0000) Subject: Add a couple of simple tests and fix typo X-Git-Url: https://git.madduck.net/etc/taskwarrior.git/commitdiff_plain/3959dcce625dfbc4ede92e73c491ca0c753e3a4f?ds=sidebyside;hp=--cc Add a couple of simple tests and fix typo --- 3959dcce625dfbc4ede92e73c491ca0c753e3a4f diff --git a/tasklib/task.py b/tasklib/task.py index c3f8f3e..182fead 100644 --- a/tasklib/task.py +++ b/tasklib/task.py @@ -76,7 +76,7 @@ class Task(object): }) def done(self): - self.warrior.execute_comamnd([self['id'], 'done']) + self.warrior.execute_command([self['id'], 'done']) def save(self): args = [self['id'], 'modify'] if self['id'] else ['add'] diff --git a/tasklib/tests.py b/tasklib/tests.py new file mode 100644 index 0000000..5344d71 --- /dev/null +++ b/tasklib/tests.py @@ -0,0 +1,27 @@ +import shutil +import tempfile +import unittest + +from .task import TaskWarrior + + +class TasklibTest(unittest.TestCase): + + def setUp(self): + self.tmp = tempfile.mkdtemp() + self.tw = TaskWarrior(data_location=self.tmp) + + def tearDown(self): + shutil.rmtree(self.tmp) + + +class TaskFilterTest(TasklibTest): + + def test_all_empty(self): + self.assertEqual(len(self.tw.tasks.all()), 0) + + def test_all_non_empty(self): + self.tw.execute_command(['add', 'test task']) + self.assertEqual(len(self.tw.tasks.all()), 1) + self.assertEqual(self.tw.tasks.all()[0]['description'], 'test task') + self.assertEqual(self.tw.tasks.all()[0]['status'], 'pending')