#!/usr/bin/env python3 """Regression for the FIFA 17 tournament-list response wrapper. CardsDLL's endpoint response parser at 0x18016b220 accepts an OBJECT root, recognizes only tournament (atom 0x328), then opens its ARRAY and invokes the element parser at 0x180169ef0. A bare array therefore parses as no tournament list at all. """ import os import pathlib import sys import tempfile TOOLS = pathlib.Path(__file__).resolve().parent sys.path.insert(0, str(TOOLS)) def main(): with tempfile.TemporaryDirectory(prefix="openfut-tournament-test-") as state: os.environ["FUT_PROFILE_ROOT"] = os.path.join(state, "accounts") os.environ.pop("FUT_PROFILE", None) import utas_server body = utas_server.tournament_list() assert isinstance(body, dict), "tournament response root must be an object" body_dict = dict(body) assert set(body_dict) == {"tournament"}, repr(body_dict) tournaments = body_dict["tournament"] assert isinstance(tournaments, list), "tournament must be an array" assert tournaments, "the offline tournament catalog must not be empty" assert all(isinstance(entry, dict) for entry in tournaments) if __name__ == "__main__": main() print("PASS: tournament response uses the recovered object/array wrapper")