Test: Drop default confirmation:off and correct tests accordingly

This commit is contained in:
Renato Alves
2015-07-28 17:00:04 +01:00
parent 1ad8aa9aec
commit fe23510c51
24 changed files with 68 additions and 46 deletions

View File

@@ -41,6 +41,19 @@ class ContextManagementTest(TestCase):
def setUp(self):
self.t = Task()
self.t.config("confirmation", "off")
def test_context_define_confirmation(self):
"""With confirmation active, prompt if context filter matches no tasks"""
self.t.config("confirmation", "on")
code, out, err = self.t.runError('context define work project:Work', timeout=0.2)
self.assertIn("The filter 'project:Work' matches 0 pending tasks.", out)
self.assertNotIn("Context 'work' defined.", out)
# Assert the config contains context definition
self.assertNotIn('context.work=project:Work\n', self.t.taskrc_content)
def test_context_define(self):
"""Test simple context definition."""
code, out, err = self.t('context define work project:Work')
@@ -274,6 +287,8 @@ class ContextEvaluationTest(TestCase):
def setUp(self):
self.t = Task()
self.t.config("confirmation", "off")
# Setup contexts
self.t('context define work project:Work')
self.t('context define home +home')