mirror of
https://github.com/tbabej/taskwiki.git
synced 2025-08-18 21:33:07 +02:00
tests: Add tests for parsing and modifying priority
This commit is contained in:
parent
d23017b4a7
commit
e0bd0f3e1a
1 changed files with 54 additions and 0 deletions
|
@ -105,3 +105,57 @@ class TestSimpleTaskWithDueDatetimeModification(IntegrationTest):
|
|||
assert task['description'] == 'This is a test task'
|
||||
assert task['status'] == 'pending'
|
||||
assert task['due'] == local_zone.localize(due)
|
||||
|
||||
|
||||
class TestSimpleTaskWithPriorityCreation(IntegrationTest):
|
||||
|
||||
viminput = """
|
||||
* [ ] This is a test task !!
|
||||
"""
|
||||
|
||||
vimoutput = """
|
||||
* [ ] This is a test task !! #{uuid}
|
||||
"""
|
||||
|
||||
def execute(self):
|
||||
self.command("w", regex="written$", lines=1)
|
||||
|
||||
# Check that only one task matches
|
||||
assert len(self.tw.tasks.pending()) == 1
|
||||
|
||||
task = self.tw.tasks.pending()[0]
|
||||
assert task['description'] == 'This is a test task'
|
||||
assert task['status'] == 'pending'
|
||||
assert task['priority'] == "M"
|
||||
|
||||
|
||||
class TestSimpleTaskWithPriorityModification(IntegrationTest):
|
||||
|
||||
viminput = """
|
||||
* [ ] This is a test task !!! #{uuid}
|
||||
"""
|
||||
|
||||
vimoutput = """
|
||||
* [ ] This is a test task ! #{uuid}
|
||||
"""
|
||||
|
||||
tasks = [
|
||||
dict(description="This is a test task", priority="H")
|
||||
]
|
||||
|
||||
def execute(self):
|
||||
# Change the current line's priority
|
||||
current_data = self.read_buffer()
|
||||
current_data[0] = current_data[0].replace('!!!', '!')
|
||||
self.write_buffer(current_data)
|
||||
|
||||
# Save the changes
|
||||
self.command("w", regex="written$", lines=1)
|
||||
|
||||
# Check that only one task exists
|
||||
assert len(self.tw.tasks.pending()) == 1
|
||||
|
||||
task = self.tw.tasks.pending()[0]
|
||||
assert task['description'] == 'This is a test task'
|
||||
assert task['status'] == 'pending'
|
||||
assert task['priority'] == "L"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue