async def test_credentials_cache_load(): user_info_cache = UserInfoCache() user_info_cache.from_dict(serialized_creds) assert user_info_cache.steam_id == _STEAM_ID assert user_info_cache.account_id == _ACCOUNT_ID assert user_info_cache.account_username == _ACCOUNT_USERNAME assert user_info_cache.persona_name == _PERSONA_NAME assert user_info_cache.token == _TOKEN assert user_info_cache.sentry == b""
async def test_credentials_cache_store(): user_info_cache = UserInfoCache() user_info_cache.steam_id = _STEAM_ID user_info_cache.account_id = _ACCOUNT_ID user_info_cache.account_username = _ACCOUNT_USERNAME user_info_cache.persona_name = _PERSONA_NAME user_info_cache.token = _TOKEN assert user_info_cache.initialized.is_set() assert serialized_creds == user_info_cache.to_dict()
def __init__(self, reader, writer, token): super().__init__(Platform.Steam, __version__, reader, writer, token) self._regmon = get_steam_registry_monitor() self._local_games_cache: Optional[List[LocalGame]] = None self._ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) self._ssl_context.load_verify_locations(certifi.where()) self._http_client = AuthenticatedHttpClient() self._client = SteamHttpClient(self._http_client) self._persistent_storage_state = PersistentCacheState() self._servers_cache = ServersCache(self._client, self._ssl_context, self.persistent_cache, self._persistent_storage_state) self._friends_cache = FriendsCache() self._games_cache = GamesCache() self._translations_cache = dict() self._stats_cache = StatsCache() self._user_info_cache = UserInfoCache() self._times_cache = TimesCache() self._steam_client = WebSocketClient( self._client, self._ssl_context, self._servers_cache, self._friends_cache, self._games_cache, self._translations_cache, self._stats_cache, self._times_cache, self._user_info_cache, self.store_credentials) self._steam_client_run_task = None self._tags_semaphore = asyncio.Semaphore(5) self._library_settings_import_iterator = 0 self._last_launch: Timestamp = 0 self._update_local_games_task = asyncio.create_task(asyncio.sleep(0)) self._update_owned_games_task = asyncio.create_task(asyncio.sleep(0)) self._owned_games_parsed = None self._auth_data = None self._cooldown_timer = time.time() async def user_presence_update_handler(user_id: str, proto_user_info: ProtoUserInfo): self.update_user_presence( user_id, await presence_from_user_info(proto_user_info, self._translations_cache)) self._friends_cache.updated_handler = user_presence_update_handler