def setUp(self, patch): """Set up an HttpProtocol instance with a fake transport""" self.fixtures_location = os.path.join(os.path.dirname(__file__), 'fixtures') self.httpprotocol = HttpProtocol('localhost', self.fixtures_location) self.transport = mock.MagicMock(spec=['write', 'close']) self.transport.write = mock.Mock() self.transport.close = mock.Mock() self.httpprotocol.connection_made(self.transport)