mirror of
https://github.com/tbabej/taskwiki.git
synced 2025-08-19 06:43:06 +02:00
tests: Add tests for TaskWikiChooseProject command
This commit is contained in:
parent
dfaef302f1
commit
a5f380db22
1 changed files with 111 additions and 0 deletions
111
tests/test_choose.py
Normal file
111
tests/test_choose.py
Normal file
|
@ -0,0 +1,111 @@
|
|||
from tests.base import IntegrationTest
|
||||
from time import sleep
|
||||
|
||||
|
||||
class TestChooseProject(IntegrationTest):
|
||||
|
||||
viminput = """
|
||||
* [ ] test task 1 #{uuid}
|
||||
* [ ] test task 2 #{uuid}
|
||||
"""
|
||||
|
||||
vimoutput = """
|
||||
* [ ] test task 1 #{uuid}
|
||||
* [ ] test task 2 #{uuid}
|
||||
"""
|
||||
|
||||
tasks = [
|
||||
dict(description="test task 1", project="Home"),
|
||||
dict(description="test task 2"),
|
||||
]
|
||||
|
||||
def execute(self):
|
||||
self.client.normal('2gg')
|
||||
sleep(1)
|
||||
|
||||
self.command("TaskWikiChooseProject")
|
||||
sleep(1)
|
||||
|
||||
self.client.normal('5gg')
|
||||
sleep(0.5)
|
||||
self.client.feedkeys("\\<CR>")
|
||||
sleep(1)
|
||||
|
||||
for task in self.tasks:
|
||||
task.refresh()
|
||||
|
||||
assert self.tasks[0]['project'] == "Home"
|
||||
assert self.tasks[1]['project'] == "Home"
|
||||
|
||||
|
||||
class TestChooseProjectUnset(IntegrationTest):
|
||||
|
||||
viminput = """
|
||||
* [ ] test task 1 #{uuid}
|
||||
* [ ] test task 2 #{uuid}
|
||||
"""
|
||||
|
||||
vimoutput = """
|
||||
* [ ] test task 1 #{uuid}
|
||||
* [ ] test task 2 #{uuid}
|
||||
"""
|
||||
|
||||
tasks = [
|
||||
dict(description="test task 1", project="Home"),
|
||||
dict(description="test task 2"),
|
||||
]
|
||||
|
||||
def execute(self):
|
||||
self.client.normal('1gg')
|
||||
sleep(0.5)
|
||||
|
||||
self.command("TaskWikiChooseProject")
|
||||
sleep(0.5)
|
||||
|
||||
self.client.normal('4gg')
|
||||
sleep(0.5)
|
||||
self.client.feedkeys("\\<CR>")
|
||||
sleep(0.5)
|
||||
|
||||
for task in self.tasks:
|
||||
task.refresh()
|
||||
|
||||
assert self.tasks[0]['project'] == None
|
||||
assert self.tasks[1]['project'] == None
|
||||
|
||||
|
||||
class TestChooseProjectCanceled(IntegrationTest):
|
||||
|
||||
viminput = """
|
||||
* [ ] test task 1 #{uuid}
|
||||
* [ ] test task 2 #{uuid}
|
||||
"""
|
||||
|
||||
vimoutput = """
|
||||
* [ ] test task 1 #{uuid}
|
||||
* [ ] test task 2 #{uuid}
|
||||
"""
|
||||
|
||||
tasks = [
|
||||
dict(description="test task 1", project="Home"),
|
||||
dict(description="test task 2"),
|
||||
]
|
||||
|
||||
def execute(self):
|
||||
self.client.normal('1gg')
|
||||
sleep(0.5)
|
||||
|
||||
self.command("TaskWikiChooseProject")
|
||||
sleep(0.5)
|
||||
|
||||
self.client.normal('4gg')
|
||||
sleep(0.5)
|
||||
self.client.feedkeys("q")
|
||||
sleep(0.5)
|
||||
|
||||
for task in self.tasks:
|
||||
task.refresh()
|
||||
|
||||
assert self.tasks[0]['project'] == "Home"
|
||||
assert self.tasks[1]['project'] == None
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue