Tests: checks for active context in 'context list'
This commit is contained in:
2
NEWS
2
NEWS
@@ -1,6 +1,8 @@
|
|||||||
|
|
||||||
New Features in Taskwarrior 2.4.5
|
New Features in Taskwarrior 2.4.5
|
||||||
|
|
||||||
|
- The active context, if one is set, is now identified in "task context list"
|
||||||
|
|
||||||
New commands in Taskwarrior 2.4.5
|
New commands in Taskwarrior 2.4.5
|
||||||
|
|
||||||
New configuration options in Taskwarrior 2.4.5
|
New configuration options in Taskwarrior 2.4.5
|
||||||
|
|||||||
@@ -143,18 +143,19 @@ class ContextManagementTest(TestCase):
|
|||||||
self.assertIn('No context is currently applied.', output)
|
self.assertIn('No context is currently applied.', output)
|
||||||
self.assertFalse(any(re.search("^context=", line) for line in self.t.taskrc_content))
|
self.assertFalse(any(re.search("^context=", line) for line in self.t.taskrc_content))
|
||||||
|
|
||||||
def test_context_list(self):
|
def test_context_list_active(self):
|
||||||
"""
|
"""
|
||||||
Test the 'context list' command.
|
Test the 'context list' command.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self.t(('context', 'define', 'work', 'project:Work'))[1]
|
self.t(('context', 'define', 'work', 'project:Work'))
|
||||||
self.t(('context', 'define', 'home', '+home'))[1]
|
self.t(('context', 'define', 'home', '+home'))
|
||||||
|
self.t(('context', 'home'))
|
||||||
|
|
||||||
output = self.t(('context', 'list'))[1]
|
output = self.t(('context', 'list'))[1]
|
||||||
|
|
||||||
contains_work = lambda line: 'work' in line and 'project:Work' in line
|
contains_work = lambda line: 'work' in line and 'project:Work' in line and 'no' in line
|
||||||
contains_home = lambda line: 'home' in line and '+home' in line
|
contains_home = lambda line: 'home' in line and '+home' in line and 'yes' in line
|
||||||
|
|
||||||
# Assert that output contains work and home context definitions exactly
|
# Assert that output contains work and home context definitions exactly
|
||||||
# once
|
# once
|
||||||
|
|||||||
Reference in New Issue
Block a user