# Path: opencenteragent/modules/output_manager.py
# LOG = logging.getLogger('opencenter.output')
# def _ok(code=0, message='success', data={}):
# def _fail(code=1, message='unknown failure', data={}):
# def _xfer_to_eof(fd_in, sock_out):
#     def __init__(self, path, config={}):
#     def register_action(self, plugin, shortpath, action, method,
#                         constraints=[], consequences=[], args={},
#                         timeout=30):
#     def actions(self):
#     def dispatch(self, input_data):
#     def handle_logfile(self, input_data, sock=None):
#     def handle_modules(self, input_data):
# class OutputManager(manager.Manager):
# 
# Path: opencenteragent/utils.py
# def detailed_exception():
# def temporary_file():
# def temporary_directory():


import fixtures
import os
import socket
import testtools
import unittest
from opencenteragent.modules import output_manager
from opencenteragent import utils




class FakeSocket(object):
    def __init__(self, protocol, transport):
        self.sent = []

    def connect(self, ip_port):
        pass

    def shutdown(self, kind):
        pass

    def close(self):
        pass

    def send(self, data):
        self.sent.append(data)
        return len(data)


class FakeSocketSendFails(FakeSocket):
    def send(self, data):
        raise Exception('send failed')


class TestModuleOutputManager(testtools.TestCase):
    def test_init(self):
        with utils.temporary_directory() as path:

# Path: opencenteragent/modules/output_manager.py
# LOG = logging.getLogger('opencenter.output')
# def _ok(code=0, message='success', data={}):
# def _fail(code=1, message='unknown failure', data={}):
# def _xfer_to_eof(fd_in, sock_out):
#     def __init__(self, path, config={}):
#     def register_action(self, plugin, shortpath, action, method,
#                         constraints=[], consequences=[], args={},
#                         timeout=30):
#     def actions(self):
#     def dispatch(self, input_data):
#     def handle_logfile(self, input_data, sock=None):
#     def handle_modules(self, input_data):
# class OutputManager(manager.Manager):
# 
# Path: opencenteragent/utils.py
# def detailed_exception():
# def temporary_file():
# def temporary_directory():


# Path: tests/test_modules_output_manager.py
import fixtures
import os
import socket
import testtools
import unittest
from opencenteragent.modules import output_manager
from opencenteragent import utils





class FakeSocket(object):
    def __init__(self, protocol, transport):
        self.sent = []

    def connect(self, ip_port):
        pass

    def shutdown(self, kind):
        pass

    def close(self):
        pass

    def send(self, data):
        self.sent.append(data)
        return len(data)


class FakeSocketSendFails(FakeSocket):
    def send(self, data):
        raise Exception('send failed')


class TestModuleOutputManager(testtools.TestCase):
    def test_init(self):
        with utils.temporary_directory() as path:

            om = output_manager.OutputManager(path)