def test_results_log__task_default(self): a_project = Project('project name') a_client = Client('client name') task = Task(a_project, a_client, 'task name') listener = DummyResultListener() task.do_subtasks([listener]) self.assertEquals("""\ BEGIN_TASK task name END_TASK task name""", listener.log())
def test_results_log__task_default(self): a_project = Project('project name') a_client = Client('client name') task = Task(a_project, a_client,'task name') listener = DummyResultListener() task.do_subtasks([listener]) self.assertEquals( """\ BEGIN_TASK task name END_TASK task name""", listener.log() )
def test_results_log__two_subtasks_first_fails(self): a_project = Project('project name') a_client = Client('client name') task = Task(a_project, a_client,'task name') task.add_subtask("subtask1", ["non-existing-command"]) task.add_subtask("subtask2", ["echo foo"]) listener = DummyResultListener() task.do_subtasks([listener]) self.assertEquals( """\ BEGIN_TASK task name BEGIN_SUBTASK subtask1 ('non-existing-command', 'failure', '\\x1b[31m/bin/sh: 1: non-existing-command: not found\\n\\x1b[0m', '', {}) END_SUBTASK subtask1 BEGIN_SUBTASK subtask2 ('echo foo', 'ok', '', '', {}) END_SUBTASK subtask2 END_TASK task name""", listener.log() )
def test_results_log__two_subtasks_first_fails(self): a_project = Project('project name') a_client = Client('client name') task = Task(a_project, a_client, 'task name') task.add_subtask("subtask1", ["non-existing-command"]) task.add_subtask("subtask2", ["echo foo"]) listener = DummyResultListener() task.do_subtasks([listener]) self.assertEquals( """\ BEGIN_TASK task name BEGIN_SUBTASK subtask1 ('non-existing-command', 'failure', '\\x1b[31m/bin/sh: 1: non-existing-command: not found\\n\\x1b[0m', '', {}) END_SUBTASK subtask1 BEGIN_SUBTASK subtask2 ('echo foo', 'ok', '', '', {}) END_SUBTASK subtask2 END_TASK task name""", listener.log())
def test_mandatory_subtask(self): a_project = Project('project name') a_client = Client('client name') task = Task(a_project, a_client,'task') task.add_subtask('subtask1', ["echo subtask1"]) task.add_subtask('subtask2', ["echo something echoed", "lsss gh"], mandatory = True) task.add_subtask('subtask3', ["echo subtask3"]) listener = DummyResultListener() task.do_subtasks([listener]) self.assertEquals("""\ BEGIN_TASK task BEGIN_SUBTASK subtask1 ('echo subtask1', 'ok', '', '', {}) END_SUBTASK subtask1 BEGIN_SUBTASK subtask2 ('echo something echoed', 'ok', '', '', {}) ('lsss gh', 'failure', '\\x1b[31m/bin/sh: 1: lsss: not found\\n\\x1b[0m', '', {}) END_SUBTASK subtask2 END_TASK task""", listener.log() )
def test_mandatory_subtask(self): a_project = Project('project name') a_client = Client('client name') task = Task(a_project, a_client, 'task') task.add_subtask('subtask1', ["echo subtask1"]) task.add_subtask('subtask2', ["echo something echoed", "lsss gh"], mandatory=True) task.add_subtask('subtask3', ["echo subtask3"]) listener = DummyResultListener() task.do_subtasks([listener]) self.assertEquals( """\ BEGIN_TASK task BEGIN_SUBTASK subtask1 ('echo subtask1', 'ok', '', '', {}) END_SUBTASK subtask1 BEGIN_SUBTASK subtask2 ('echo something echoed', 'ok', '', '', {}) ('lsss gh', 'failure', '\\x1b[31m/bin/sh: 1: lsss: not found\\n\\x1b[0m', '', {}) END_SUBTASK subtask2 END_TASK task""", listener.log())