extends "res://tests/test_case.gd" const SteamBootstrap = preload("res://scripts/steam_bootstrap.gd") # Web-API ticket acquisition (task 7.6). Nothing in the project could obtain a # ticket before, so ControlPlaneClient.login_steam() had no production caller. # These run on stock Godot, which has no GodotSteam symbols, so they cover the # pure encoding and the unavailable path rather than a live Steam session. func test_web_api_ticket_is_unsupported_without_the_steam_runtime() -> void: if SteamBootstrap.is_runtime_available(): return assert_true(not SteamBootstrap.supports_web_api_ticket(), "no ticket support without the custom build") assert_eq(SteamBootstrap.request_web_api_ticket(), 0, "requesting a ticket yields no handle") # Must not throw on stock Godot; cancelling a handle we never got is a no-op. SteamBootstrap.cancel_web_api_ticket(0) SteamBootstrap.cancel_web_api_ticket(17) func test_web_api_ticket_encoding_is_lowercase_hex() -> void: # The publisher Web API expects the raw ticket bytes hex encoded; the # backend rejects anything non-hex before it forwards a ticket to Valve. assert_eq(SteamBootstrap.encode_web_api_ticket(PackedByteArray()), "", "an empty ticket encodes to nothing") assert_eq(SteamBootstrap.encode_web_api_ticket(PackedByteArray([0x00, 0x0f, 0xa5, 0xff])), "000fa5ff", "bytes are zero-padded lowercase hex") var encoded := SteamBootstrap.encode_web_api_ticket(PackedByteArray([1, 2, 3, 4, 250])) assert_eq(encoded.length(), 10, "each byte becomes exactly two characters") assert_eq(encoded, encoded.to_lower(), "encoding is lowercase")