steam-backlog-enforcer/_installer_import/tests/test_vdf.py
Krzysztof kuhy Rudnicki 72390acc2c Initial implementation: fast Steam installs via depotdownloader + steamcmd
Wraps depotdownloader for the bulk content pull (bypasses Steam's own
capped download speed) and steamcmd's app_update --validate to make Steam
recognize the result, with a manual-manifest fallback for the confirmed
steamcmd install-script segfault bug when no fix is available. Name search
via store.steampowered.com is best-effort since that endpoint TLS-rejects
scripted clients on this network; --appid plus steamcmd's own app_info_print
is the reliable primary path.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-23 12:50:26 +02:00

69 lines
1.2 KiB
Python

from steam_installer import vdf
def test_parse_flat_block():
text = """
"AppState"
{
"appid" "1771300"
"name" "Kingdom Come: Deliverance II"
}
"""
result = vdf.parse(text)
assert result == {
"AppState": {
"appid": "1771300",
"name": "Kingdom Come: Deliverance II",
}
}
def test_parse_nested_blocks():
text = """
"AppState"
{
"InstalledDepots"
{
"1771302"
{
"manifest" "257127247679847518"
"size" "199419496"
}
}
}
"""
result = vdf.parse(text)
assert (
result["AppState"]["InstalledDepots"]["1771302"]["manifest"]
== "257127247679847518"
)
def test_parse_handles_comments_and_blank_lines():
text = """
// leading comment
"AppState"
{
"appid" "1" // trailing comment
}
"""
result = vdf.parse(text)
assert result == {"AppState": {"appid": "1"}}
def test_roundtrip_dumps_then_parse():
data = {
"appid": "1771300",
"InstalledDepots": {
"1771302": {"manifest": "257127247679847518", "size": "199419496"},
},
}
text = vdf.dumps("AppState", data)
reparsed = vdf.parse(text)
assert reparsed == {"AppState": data}
def test_empty_input_returns_empty_dict():
assert vdf.parse("") == {}