def test_teleport_confirmation_new(self): connection = mock.MagicMock() connection.context = ConnectionContext(protocol_version=107) reactor = PlayingReactor(connection) packet = self.get_position_packet() reactor.react(packet) self.assertEqual(connection.write_packet.call_count, 1) response_packet = connection.write_packet.call_args[0][0] self.assertEqual(response_packet.teleport_id, 42)
def test_teleport_confirmation_old(self): connection = mock.MagicMock() connection.context = ConnectionContext(protocol_version=106) reactor = PlayingReactor(connection) packet = self.get_position_packet() reactor.react(packet) self.assertEqual(connection.write_packet.call_count, 1) response_packet = connection.write_packet.call_args[0][0] self.assertEqual(response_packet.x, 1.0) self.assertEqual(response_packet.feet_y, 2.0) self.assertEqual(response_packet.z, 3.0) self.assertEqual(response_packet.yaw, 4.0) self.assertEqual(response_packet.pitch, 5.0) self.assertTrue(response_packet.on_ground)