async def test_session_self_update(client: NetworkClient): client._emit_with_result = AsyncMock() client._current_game_session_meta = MagicMock() client._current_game_session_meta.id = 1234 inventory: Inventory = { ItemResourceInfo(33, "None", "None", 1): InventoryItem(1, 1) } await client.session_self_update(inventory, GameConnectionStatus.InGame, MemoryExecutorChoice.DOLPHIN) client._emit_with_result.assert_awaited_once_with( "game_session_self_update", (1234, b'\x01None\x00\x01\x01', "In-game (Dolphin)"))
async def test_leave_game_session(client: NetworkClient, permanent: bool): client._emit_with_result = AsyncMock() client._current_game_session_meta = MagicMock() client._current_game_session_meta.id = 1234 client._current_user = MagicMock() client._current_user.id = 5678 # Run await client.leave_game_session(permanent) # Assert calls = [call("disconnect_game_session", 1234)] if permanent: calls.insert( 0, call("game_session_admin_player", (1234, 5678, SessionAdminUserAction.KICK.value, None))) client._emit_with_result.assert_has_awaits(calls) assert client._current_game_session_meta is None