# Path: haigha/transports/event_transport.py
# class EventTransport(Transport):
#     def __init__(self, *args):
#     def _sock_close_cb(self, sock):
#     def _sock_error_cb(self, sock, msg, exception=None):
#     def _sock_read_cb(self, sock):
#     def connect(self, (host, port)):
#     def read(self, timeout=None):
#     def buffer(self, data):
#     def write(self, data):
#     def disconnect(self):


from chai import Chai
from haigha.transports import event_transport
from haigha.transports.event_transport import *
        assert_equals('buffereddata', self.transport.read())

    def test_read_with_timeout_and_no_current_one(self):
        self.transport._heartbeat_timeout = None
        self.transport._sock = mock()
        mock(event_transport, 'event')
        expect(event_transport.event.timeout).args(
            'timeout', self.transport._sock_read_cb, self.transport._sock).returns(
            'timer')

        expect(self.transport._sock.read).returns('buffereddata')
        assert_equals('buffereddata', self.transport.read('timeout'))
        assert_equals('timer', self.transport._heartbeat_timeout)

    def test_read_with_timeout_and_current_one(self):
        self.transport._heartbeat_timeout = mock()
        self.transport._sock = mock()
        mock(event_transport, 'event')
        expect(self.transport._heartbeat_timeout.delete)
        expect(event_transport.event.timeout).args(
            'timeout', self.transport._sock_read_cb, self.transport._sock).returns(
            'timer')

        expect(self.transport._sock.read).returns('buffereddata')
        assert_equals('buffereddata', self.transport.read('timeout'))
        assert_equals('timer', self.transport._heartbeat_timeout)

    def test_read_without_timeout_but_current_one(self):
        self.transport._heartbeat_timeout = mock()
        self.transport._sock = mock()

# Path: haigha/transports/event_transport.py
# class EventTransport(Transport):
#     def __init__(self, *args):
#     def _sock_close_cb(self, sock):
#     def _sock_error_cb(self, sock, msg, exception=None):
#     def _sock_read_cb(self, sock):
#     def connect(self, (host, port)):
#     def read(self, timeout=None):
#     def buffer(self, data):
#     def write(self, data):
#     def disconnect(self):


# Path: tests/unit/transports/event_transport_test.py
from chai import Chai
from haigha.transports import event_transport
from haigha.transports.event_transport import *

        assert_equals('buffereddata', self.transport.read())

    def test_read_with_timeout_and_no_current_one(self):
        self.transport._heartbeat_timeout = None
        self.transport._sock = mock()
        mock(event_transport, 'event')
        expect(event_transport.event.timeout).args(
            'timeout', self.transport._sock_read_cb, self.transport._sock).returns(
            'timer')

        expect(self.transport._sock.read).returns('buffereddata')
        assert_equals('buffereddata', self.transport.read('timeout'))
        assert_equals('timer', self.transport._heartbeat_timeout)

    def test_read_with_timeout_and_current_one(self):
        self.transport._heartbeat_timeout = mock()
        self.transport._sock = mock()
        mock(event_transport, 'event')
        expect(self.transport._heartbeat_timeout.delete)
        expect(event_transport.event.timeout).args(
            'timeout', self.transport._sock_read_cb, self.transport._sock).returns(
            'timer')

        expect(self.transport._sock.read).returns('buffereddata')
        assert_equals('buffereddata', self.transport.read('timeout'))
        assert_equals('timer', self.transport._heartbeat_timeout)

    def test_read_without_timeout_but_current_one(self):
        self.transport._heartbeat_timeout = mock()
        self.transport._sock = mock()

        mock(event_transport, 'event')