Exemple #1
0
    def test_add_player_action(self):
        player_list = PlayerListItemPacket.PlayerList()

        packet_buffer = self.make_add_player_packet()

        packet = PlayerListItemPacket()
        packet.read(packet_buffer)
        packet.apply(player_list)

        self.assertIn(fake_uuid, player_list.players_by_uuid)
        player = player_list.players_by_uuid[fake_uuid]

        self.assertEqual(player.name, "player")
        self.assertEqual(player.properties[0].name, "property1")
        self.assertIsNone(player.properties[0].signature)
        self.assertEqual(player.properties[1].value, "value2")
        self.assertEqual(player.properties[1].signature, "signature")
        self.assertEqual(player.gamemode, 42)
        self.assertEqual(player.ping, 69)
        self.assertEqual(player.display_name, "display")
    def test_add_player_action(self):
        player_list = PlayerListItemPacket.PlayerList()

        packet_buffer = self.make_add_player_packet()

        packet = PlayerListItemPacket()
        packet.read(packet_buffer)
        packet.apply(player_list)

        self.assertIn(fake_uuid, player_list.players_by_uuid)
        player = player_list.players_by_uuid[fake_uuid]

        self.assertEqual(player.name, "player")
        self.assertEqual(player.properties[0].name, "property1")
        self.assertIsNone(player.properties[0].signature)
        self.assertEqual(player.properties[1].value, "value2")
        self.assertEqual(player.properties[1].signature, "signature")
        self.assertEqual(player.gamemode, 42)
        self.assertEqual(player.ping, 69)
        self.assertEqual(player.display_name, "display")
Exemple #3
0
    def test_add_player_action(self):
        for protocol_version in TEST_VERSIONS:
            context = ConnectionContext(protocol_version=protocol_version)
            player_list = PlayerListItemPacket.PlayerList()
            packet_buffer = self.make_add_player_packet(context)

            packet = PlayerListItemPacket(context)
            packet.read(packet_buffer)
            packet.apply(player_list)

            self.assertIn(fake_uuid, player_list.players_by_uuid)
            player = player_list.players_by_uuid[fake_uuid]

            self.assertEqual(player.name, 'goodmonson')
            self.assertEqual(player.properties[0].name, 'property1')
            self.assertIsNone(player.properties[0].signature)
            self.assertEqual(player.properties[1].value, 'value2')
            self.assertEqual(player.properties[1].signature, 'gm')
            self.assertEqual(player.gamemode, 42)
            self.assertEqual(player.ping, 69)
            self.assertEqual(player.display_name, 'Goodmonson')
Exemple #4
0
 def read_and_apply(self, context, packet_buffer, player_list):
     packet_buffer.reset_cursor()
     packet = PlayerListItemPacket(context)
     packet.read(packet_buffer)
     packet.apply(player_list)
 def read_and_apply(self, packet_buffer, player_list):
     packet_buffer.reset_cursor()
     packet = PlayerListItemPacket()
     packet.read(packet_buffer)
     packet.apply(player_list)