From f96c810ffbcff410dbd3a58a53bee2fd9f296da2 Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Sun, 27 Dec 2015 12:41:36 +0100 Subject: [PATCH] tests: Expand test coverage --- tests/test_choose.py | 40 +++++++++++++++++++- tests/test_selected.py | 85 ++++++++++++++++++++++++++++++++++++++++++ tests/test_splits.py | 24 ++++++++++++ tests/test_viewport.py | 38 +++++++++++++++++++ 4 files changed, 186 insertions(+), 1 deletion(-) diff --git a/tests/test_choose.py b/tests/test_choose.py index bbaea1d..d98837d 100644 --- a/tests/test_choose.py +++ b/tests/test_choose.py @@ -179,5 +179,43 @@ class TestChooseTagCancelled(IntegrationTest): task.refresh() assert self.tasks[0]['tags'] == set(["home"]) - assert self.tasks[1]['project'] == None + assert self.tasks[1]['tags'] == set() + + +class TestChooseTagNoSelected(IntegrationTest): + + viminput = """ + * [ ] test task 1 #{uuid} + * [ ] test task 2 #{uuid} + """ + + vimoutput = """ + Tag Count + ---- ----- + home 1 + """ + + tasks = [ + dict(description="test task 1", tags=["home"]), + dict(description="test task 2"), + ] + + def execute(self): + self.client.normal('1gg') + sleep(0.5) + + self.command("TaskWikiChooseTag") + sleep(0.5) + + # No tak on the 5th row + self.client.normal('5gg') + sleep(0.5) + self.client.feedkeys("\\") + sleep(0.5) + + for task in self.tasks: + task.refresh() + + assert self.tasks[0]['tags'] == set(["home"]) + assert self.tasks[1]['tags'] == set() diff --git a/tests/test_selected.py b/tests/test_selected.py index b93adb6..4d43cf8 100644 --- a/tests/test_selected.py +++ b/tests/test_selected.py @@ -259,6 +259,35 @@ class TestInfoAction(IntegrationTest): assert re.search(data2, output, re.MULTILINE) +class TestInfoActionTriggeredByEnter(IntegrationTest): + + viminput = """ + * [ ] test task 1 #{uuid} + * [ ] test task 2 #{uuid} + """ + + tasks = [ + dict(description="test task 1"), + dict(description="test task 2"), + ] + + def execute(self): + self.client.type('1gg') + self.client.feedkeys("\\") + sleep(0.5) + + assert self.command(":py print vim.current.buffer", silent=False).startswith("") + sleep(0.5) diff --git a/tests/test_splits.py b/tests/test_splits.py index 9b583a3..6f7a59b 100644 --- a/tests/test_splits.py +++ b/tests/test_splits.py @@ -246,6 +246,30 @@ class TestTagsSimple(IntegrationTest): assert re.search(work, output, re.MULTILINE) +class TestTagsSimpleFiltered(IntegrationTest): + + tasks = [ + dict(description="home task"), + dict(description="home chore task 1", tags=['chore']), + dict(description="home chore task 2", tags=['chore']), + dict(description="work task 1", tags=['work']), + dict(description="work task 2", tags=['work']), + ] + + def execute(self): + self.command("TaskWikiTags +chore") + assert self.command(":py print vim.current.buffer", silent=False).startswith("') + sleep(0.5) + + assert self.command(":py print vim.current.buffer", regex="