From 80d39e1f7bea06adf9df0f4f6a7d12f355b3a1ad Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Mon, 23 May 2016 11:04:06 +0200 Subject: [PATCH 1/1] tests: Cover deleted and waiting native queryset filters --- tasklib/tests.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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() -- 2.39.5