test(fifa17): harden SBC retail acceptance
This commit is contained in:
@@ -123,8 +123,8 @@ def main():
|
||||
|
||||
body = json.dumps({"squad": [1, 2, 3], "note": "x" * 300}).encode()
|
||||
reqs = [
|
||||
b"GET /ut/game/fifa17/userMassInfo HTTP/1.1\r\nHost: t\r\n\r\n",
|
||||
b"POST /ut/game/fifa17/purchased/items HTTP/1.1\r\nHost: t\r\n"
|
||||
b"GET /ut/game/fifa17/sbs/sets HTTP/1.1\r\nHost: t\r\n\r\n",
|
||||
b"POST /ut/game/fifa17/sbs/challenge/101/squad HTTP/1.1\r\nHost: t\r\n"
|
||||
b"Content-Type: application/json\r\nContent-Length: %d\r\n\r\n" % len(body) + body,
|
||||
b"GET /chunked?deviceId=DEADBEEFCAFE&keep=yes HTTP/1.1\r\nHost: t\r\n\r\n",
|
||||
b"GET /ut/game/fifa17/hub HTTP/1.1\r\nHost: t\r\nConnection: close\r\n\r\n",
|
||||
@@ -180,8 +180,8 @@ def main():
|
||||
if len(txs) == 4:
|
||||
check("methods and paths in order",
|
||||
[(t["request"]["method"], t["request"]["path"]) for t in txs] ==
|
||||
[("GET", "/ut/game/fifa17/userMassInfo"),
|
||||
("POST", "/ut/game/fifa17/purchased/items"),
|
||||
[("GET", "/ut/game/fifa17/sbs/sets"),
|
||||
("POST", "/ut/game/fifa17/sbs/challenge/101/squad"),
|
||||
("GET", "/chunked"),
|
||||
("GET", "/ut/game/fifa17/hub")])
|
||||
check("request body preserved byte-for-byte",
|
||||
@@ -210,6 +210,20 @@ def main():
|
||||
qtx is not None and "keep=yes" in qtx["request"]["query"],
|
||||
qtx["request"]["query"] if qtx else "")
|
||||
|
||||
print("== path-scoped fixture ==")
|
||||
r = subprocess.run(
|
||||
[sys.executable, TOOL, "parse", "--session", SESSION,
|
||||
"--path-prefix", "/ut/game/fifa17/sbs/"],
|
||||
capture_output=True, text=True)
|
||||
print(" " + r.stdout.strip().replace("\n", "\n "))
|
||||
filtered = [json.loads(l) for l in
|
||||
open(os.path.join(SESSION, "sanitized", "transactions.jsonl"))]
|
||||
check("SBC prefix emits only the two SBC transactions", len(filtered) == 2,
|
||||
"got %d" % len(filtered))
|
||||
check("SBC save body remains byte-exact after scoped parse",
|
||||
len(filtered) == 2 and
|
||||
base64.b64decode(filtered[1]["request"]["body_b64"]) == body)
|
||||
|
||||
srv.shutdown()
|
||||
print()
|
||||
print("all checks passed" if not fails else "%d FAILED: %s" % (len(fails), fails))
|
||||
|
||||
Reference in New Issue
Block a user