Esempio n. 1
0
    def test_write_stderr(self):
        message = "this is the message"
        serializer = mock.create_autospec(filehandler.FileHandleManager)
        fh = serializer.open.return_value = mock.create_autospec(
            filehandler.FileHandleWrapper)
        ac = ActionCommand("action.1.do", "do", serializer)

        ac.write_stderr(message)
        fh.write.assert_called_with(message)
Esempio n. 2
0
def build_action(task, command=None):
    """Create an action for a task which is an Observer, and which has
    properties 'task_name', 'command', and 'buffer_store'.
    """
    name = '%s.%s' % (task.id, task.task_name)
    command = command or task.command
    action = ActionCommand(name, command, serializer=task.buffer_store)
    task.watch(action)
    return action
Esempio n. 3
0
 def test_init_no_serializer(self):
     ac = ActionCommand("action.1.do", "do")
     ac.write_stdout("something")
     ac.write_stderr("else")
     assert_equal(ac.stdout, filehandler.NullFileHandle)
     ac.done()
Esempio n. 4
0
 def setup_command(self):
     self.serializer = mock.create_autospec(filehandler.FileHandleManager)
     self.serializer.open.return_value = filehandler.NullFileHandle
     self.ac = ActionCommand("action.1.do", "do", self.serializer)