]> git.madduck.net Git - etc/taskwarrior.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

tests: Add dummy tests for filtering
authorTomas Babej <tomasbabej@gmail.com>
Fri, 20 Feb 2015 16:42:28 +0000 (17:42 +0100)
committerTomas Babej <tomasbabej@gmail.com>
Fri, 20 Feb 2015 17:19:10 +0000 (18:19 +0100)
tasklib/tests.py

index 5f8bcf98c2afb054006e3aa5ab664c52efaa3dfd..540330f99ff93a2bb5a2d49392855ca8afb99677 100644 (file)
@@ -129,6 +129,100 @@ class TaskFilterTest(TasklibTest):
     def test_filter_with_empty_uuid(self):
         self.assertRaises(ValueError, lambda: self.tw.tasks.get(uuid=''))
 
+    def test_filter_dummy_by_status(self):
+        t = Task(self.tw, description="test")
+        t.save()
+
+        tasks = self.tw.tasks.filter(status=t['status'])
+        self.assertEqual(list(tasks), [t])
+
+    def test_filter_dummy_by_uuid(self):
+        t = Task(self.tw, description="test")
+        t.save()
+
+        tasks = self.tw.tasks.filter(uuid=t['uuid'])
+        self.assertEqual(list(tasks), [t])
+
+    def test_filter_dummy_by_entry(self):
+        t = Task(self.tw, description="test")
+        t.save()
+
+        tasks = self.tw.tasks.filter(entry=t['entry'])
+        self.assertEqual(list(tasks), [t])
+
+    def test_filter_dummy_by_description(self):
+        t = Task(self.tw, description="test")
+        t.save()
+
+        tasks = self.tw.tasks.filter(description=t['description'])
+        self.assertEqual(list(tasks), [t])
+
+    def test_filter_dummy_by_start(self):
+        t = Task(self.tw, description="test")
+        t.save()
+        t.start()
+
+        tasks = self.tw.tasks.filter(start=t['start'])
+        self.assertEqual(list(tasks), [t])
+
+    def test_filter_dummy_by_end(self):
+        t = Task(self.tw, description="test")
+        t.save()
+        t.done()
+
+        tasks = self.tw.tasks.filter(end=t['end'])
+        self.assertEqual(list(tasks), [t])
+
+    def test_filter_dummy_by_due(self):
+        t = Task(self.tw, description="test", due=datetime.datetime.now())
+        t.save()
+
+        tasks = self.tw.tasks.filter(due=t['due'])
+        self.assertEqual(list(tasks), [t])
+
+    def test_filter_dummy_by_until(self):
+        t = Task(self.tw, description="test")
+        t.save()
+
+        tasks = self.tw.tasks.filter(until=t['until'])
+        self.assertEqual(list(tasks), [t])
+
+    def test_filter_dummy_by_modified(self):
+        t = Task(self.tw, description="test")
+        t.save()
+
+        tasks = self.tw.tasks.filter(modified=t['modified'])
+        self.assertEqual(list(tasks), [t])
+
+    def test_filter_dummy_by_scheduled(self):
+        t = Task(self.tw, description="test")
+        t.save()
+
+        tasks = self.tw.tasks.filter(scheduled=t['scheduled'])
+        self.assertEqual(list(tasks), [t])
+
+    def test_filter_dummy_by_tags(self):
+        t = Task(self.tw, description="test", tags=["home"])
+        t.save()
+
+        tasks = self.tw.tasks.filter(tags=t['tags'])
+        self.assertEqual(list(tasks), [t])
+
+    def test_filter_dummy_by_projects(self):
+        t = Task(self.tw, description="test", project="random")
+        t.save()
+
+        tasks = self.tw.tasks.filter(project=t['project'])
+        self.assertEqual(list(tasks), [t])
+
+    def test_filter_by_priority(self):
+        t = Task(self.tw, description="test", priority="H")
+        t.save()
+
+        tasks = self.tw.tasks.filter(priority=t['priority'])
+        self.assertEqual(list(tasks), [t])
+
+
 class TaskTest(TasklibTest):
 
     def test_create_unsaved_task(self):