From: Tomas Babej Date: Mon, 23 May 2016 09:04:06 +0000 (+0200) Subject: tests: Cover deleted and waiting native queryset filters X-Git-Url: https://git.madduck.net/etc/taskwarrior.git/commitdiff_plain/80d39e1f7bea06adf9df0f4f6a7d12f355b3a1ad?ds=sidebyside;hp=--cc tests: Cover deleted and waiting native queryset filters --- 80d39e1f7bea06adf9df0f4f6a7d12f355b3a1ad diff --git a/tasklib/tests.py b/tasklib/tests.py index ca2ff4a..3656bbf 100644 --- a/tasklib/tests.py +++ b/tasklib/tests.py @@ -81,6 +81,30 @@ class TaskFilterTest(TasklibTest): self.tw.tasks.all()[0].done() self.assertEqual(len(self.tw.tasks.completed()), 1) + def test_deleted_empty(self): + Task(self.tw, description="test task").save() + self.assertEqual(len(self.tw.tasks.deleted()), 0) + + def test_deleted_non_empty(self): + Task(self.tw, description="test task").save() + self.assertEqual(len(self.tw.tasks.deleted()), 0) + self.tw.tasks.all()[0].delete() + self.assertEqual(len(self.tw.tasks.deleted()), 1) + + def test_waiting_empty(self): + Task(self.tw, description="test task").save() + self.assertEqual(len(self.tw.tasks.waiting()), 0) + + def test_waiting_non_empty(self): + Task(self.tw, description="test task").save() + self.assertEqual(len(self.tw.tasks.waiting()), 0) + + t = self.tw.tasks.all()[0] + t['wait'] = 'tomorrow' + t.save() + + self.assertEqual(len(self.tw.tasks.waiting()), 1) + def test_filtering_by_attribute(self): Task(self.tw, description="no priority task").save() Task(self.tw, priority="H", description="high priority task").save()