def given_a_connection_start_method_I_copied_from_the_rabbitmq_server( self): self.raw = ( b"\x01\x00\x00\x00\x00\x01\x50" # type, channel, size b"\x00\x0A\x00\x0A\x00\t\x00\x00\x01" b"%\x0ccapabilitiesF\x00\x00\x00X\x12publisher_confirmst\x01\x1aexchange_exchange_bindings" b"t\x01\nbasic.nackt\x01\x16consumer_cancel_notifyt\x01\tcopyrightS\x00\x00\x00'Copyright " b"(C) 2007-2013 GoPivotal, Inc.\x0binformationS\x00\x00\x005Licensed under the MPL. " b" See http://www.rabbitmq.com/\x08platformS\x00\x00\x00\nErlang/OTP\x07productS\x00\x00\x00\x08" b"RabbitMQ\x07versionS\x00\x00\x00\x053.1.5" b"\x00\x00\x00\x0eAMQPLAIN PLAIN\x00\x00\x00\x0Ben_US en_GB\xCE") expected_method = spec.ConnectionStart( 0, 9, { 'capabilities': { 'publisher_confirms': True, 'exchange_exchange_bindings': True, 'basic.nack': True, 'consumer_cancel_notify': True }, 'copyright': 'Copyright (C) 2007-2013 GoPivotal, Inc.', 'information': 'Licensed under the MPL. See http://www.rabbitmq.com/', 'platform': 'Erlang/OTP', 'product': 'RabbitMQ', 'version': '3.1.5' }, 'AMQPLAIN PLAIN', 'en_US en_GB') self.expected_frame = asynqp.frames.MethodFrame(0, expected_method)
def given_a_closed_connection(self): t = asyncio.async(self.connection.close()) t._log_destroy_pending = False self.tick() start_method = spec.ConnectionStart(0, 9, {}, 'PLAIN AMQPLAIN', 'en_US') self.start_frame = asynqp.frames.MethodFrame(0, start_method) self.mock_writer = mock.Mock()
def given_a_started_connection(self): connection_info = { 'username': '******', 'password': '******', 'virtual_host': '/' } self.async_partial( open_connection(self.loop, self.transport, self.protocol, self.dispatcher, connection_info)) self.server.send_method( 0, spec.ConnectionStart(0, 9, {}, 'PLAIN AMQPLAIN', 'en_US'))
def given_an_open_connection(self): connection_info = {'username': '******', 'password': '******', 'virtual_host': '/'} task = asyncio.ensure_future(open_connection(self.loop, self.transport, self.protocol, self.dispatcher, connection_info)) self.tick() start_method = spec.ConnectionStart(0, 9, {}, 'PLAIN AMQPLAIN', 'en_US') self.server.send_method(0, start_method) tune_method = spec.ConnectionTune(0, 131072, 600) self.frame_max = tune_method.frame_max self.server.send_method(0, tune_method) self.server.send_method(0, spec.ConnectionOpenOK('')) self.connection = task.result()
def given_an_open_connection(self): connection_info = ConnectionInfo('guest', 'guest', '/') task = asyncio. async (open_connection(self.loop, self.protocol, self.dispatcher, connection_info)) self.tick() start_method = spec.ConnectionStart(0, 9, {}, 'PLAIN AMQPLAIN', 'en_US') self.server.send_method(0, start_method) tune_method = spec.ConnectionTune(0, 131072, 600) self.frame_max = tune_method.frame_max self.server.send_method(0, tune_method) self.server.send_method(0, spec.ConnectionOpenOK('')) self.connection = task.result()
def given_an_open_connection(self): task = asyncio. async (open_connection(self.loop, self.protocol, self.dispatcher, self.connection_info)) self.tick() start_frame = asynqp.frames.MethodFrame( 0, spec.ConnectionStart(0, 9, {}, 'PLAIN AMQPLAIN', 'en_US')) self.dispatcher.dispatch(start_frame) self.tick() self.frame_max = 131072 tune_frame = asynqp.frames.MethodFrame( 0, spec.ConnectionTune(0, self.frame_max, 600)) self.dispatcher.dispatch(tune_frame) self.tick() open_ok_frame = asynqp.frames.MethodFrame(0, spec.ConnectionOpenOK('')) self.dispatcher.dispatch(open_ok_frame) self.tick() self.protocol.reset_mock() self.connection = task.result()
def when_ConnectionStart_arrives(self): self.server.send_method( 0, spec.ConnectionStart(0, 9, {}, 'PLAIN AMQPLAIN', 'en_US'))
def when_another_frame_arrives(self): self.server.send_method( 0, spec.ConnectionStart(0, 9, {}, 'PLAIN AMQPLAIN', 'en_US')) self.tick()
def given_a_started_connection(self): connection_info = ConnectionInfo('guest', 'guest', '/') self.async_partial(open_connection(self.loop, self.protocol, self.dispatcher, connection_info)) self.server.send_method(0, spec.ConnectionStart(0, 9, {}, 'PLAIN AMQPLAIN', 'en_US'))