def test_channel0_send_tune_ok_negotiate(self): channel = Channel0(FakeConnection()) channel._send_tune_ok( Connection.Tune(frame_max=MAX_FRAME_SIZE, channel_max=MAX_CHANNELS)) self.assertEqual(channel.max_frame_size, MAX_FRAME_SIZE) self.assertEqual(channel.max_allowed_channels, MAX_CHANNELS)
def test_channel0_send_tune_ok_negotiate_use_max(self): """Test to make sure that we use the highest acceptable value when the server returns zero. """ channel = Channel0(FakeConnection()) channel._send_tune_ok(Connection.Tune()) self.assertEqual(channel.max_frame_size, MAX_FRAME_SIZE) self.assertEqual(channel.max_allowed_channels, MAX_CHANNELS)
def test_channel0_tune_frame(self): connection = FakeConnection() connection.parameters['virtual_host'] = '/' channel = Channel0(connection) channel.on_frame(Connection.Tune()) self.assertIsInstance(connection.get_last_frame(), Connection.TuneOk) self.assertIsInstance(connection.get_last_frame(), Connection.Open)
def test_channel0_send_tune_ok_negotiate_use_server(self): """Test to make sure that we use the highest acceptable value from the servers perspective. """ channel = Channel0(FakeConnection()) channel._send_tune_ok(Connection.Tune(frame_max=16384, channel_max=200)) self.assertEqual(channel.max_frame_size, 16384) self.assertEqual(channel.max_allowed_channels, 200)
def test_channel0_send_tune_ok(self): connection = FakeConnection() channel = Channel0(connection) channel._send_tune_ok(Connection.Tune()) self.assertTrue(connection.frames_out) channel_id, frame_out = connection.frames_out.pop() self.assertEqual(channel_id, 0) self.assertIsInstance(frame_out, Connection.TuneOk) self.assertEqual(frame_out.channel_max, MAX_CHANNELS) self.assertEqual(frame_out.frame_max, MAX_FRAME_SIZE)