From bf29210719f195166fa5ff0a85e668d13896d284 Mon Sep 17 00:00:00 2001 From: Renato Alves Date: Thu, 4 Jun 2015 20:55:15 +0100 Subject: [PATCH] Tests: checks for active context in 'context list' --- NEWS | 2 ++ test/context.t | 11 ++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 4d5375bb5..8557d1616 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,8 @@ 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 configuration options in Taskwarrior 2.4.5 diff --git a/test/context.t b/test/context.t index b040ea83f..e8b5bf314 100755 --- a/test/context.t +++ b/test/context.t @@ -143,18 +143,19 @@ class ContextManagementTest(TestCase): self.assertIn('No context is currently applied.', output) 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. """ - self.t(('context', 'define', 'work', 'project:Work'))[1] - self.t(('context', 'define', 'home', '+home'))[1] + self.t(('context', 'define', 'work', 'project:Work')) + self.t(('context', 'define', 'home', '+home')) + self.t(('context', 'home')) output = self.t(('context', 'list'))[1] - contains_work = lambda line: 'work' in line and 'project:Work' in line - contains_home = lambda line: 'home' in line and '+home' 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 and 'yes' in line # Assert that output contains work and home context definitions exactly # once