Feature: Integrate all four Hogwarts mini-games (Duel, Potion Brewing, Cryptex Lock, Cornish Pixies)
This commit is contained in:
+57
-5
@@ -24,6 +24,20 @@ def test_endpoints():
|
||||
assert res.status_code in [301, 302]
|
||||
assert res.headers["location"] == "/duel"
|
||||
|
||||
# Test new mini-games: Brew, Cryptex, Pixies
|
||||
res = client.get("/brew")
|
||||
assert res.status_code == 200
|
||||
assert "Die Zaubertrank-Brauküche" in res.text
|
||||
assert "Felix Felicis" in res.text
|
||||
|
||||
res = client.get("/cryptex")
|
||||
assert res.status_code == 200
|
||||
assert "Das Runen-Drehschloss" in res.text
|
||||
|
||||
res = client.get("/pixies")
|
||||
assert res.status_code == 200
|
||||
assert "Wichtel-Panik" in res.text
|
||||
|
||||
res = client.get("/bottles")
|
||||
assert res.status_code == 200
|
||||
assert "Snapes Flaschenrätsel" in res.text
|
||||
@@ -55,8 +69,7 @@ def test_endpoints():
|
||||
# Test API Broom complete
|
||||
res = client.post("/api/broom/complete", json={"score": 850, "time_taken": 22})
|
||||
assert res.status_code == 200
|
||||
data = res.json()
|
||||
assert data["success"] is True
|
||||
assert res.json()["success"] is True
|
||||
|
||||
# Test API Duel complete (adds duel_badge)
|
||||
res = client.post("/api/duel/complete")
|
||||
@@ -64,14 +77,53 @@ def test_endpoints():
|
||||
duel_data = res.json()
|
||||
assert duel_data["success"] is True
|
||||
assert duel_data["new_item"]["id"] == "duel_badge"
|
||||
assert "duel_badge" in duel_data["state"]["inventory"]
|
||||
|
||||
# Test API Brew complete (adds felix_felicis)
|
||||
res = client.post("/api/brew/complete")
|
||||
assert res.status_code == 200
|
||||
brew_data = res.json()
|
||||
assert brew_data["success"] is True
|
||||
assert brew_data["new_item"]["id"] == "felix_felicis"
|
||||
|
||||
# Test API Cryptex unlock (wrong then correct)
|
||||
res = client.post("/api/cryptex/unlock", json={"combination": ["🐍", "☀️", "💧", "🗝️"]})
|
||||
assert res.status_code == 200
|
||||
assert res.json()["success"] is False
|
||||
|
||||
res = client.post("/api/cryptex/unlock", json={"combination": ["🦁", "🌙", "🔥", "🪄"]})
|
||||
assert res.status_code == 200
|
||||
cryp_data = res.json()
|
||||
assert cryp_data["success"] is True
|
||||
assert cryp_data["new_item"]["id"] == "cryptex_key"
|
||||
|
||||
# Test API Pixies complete (under 10 then >= 10)
|
||||
res = client.post("/api/pixies/complete", json={"caught": 5})
|
||||
assert res.status_code == 200
|
||||
assert res.json()["success"] is False
|
||||
|
||||
res = client.post("/api/pixies/complete", json={"caught": 10})
|
||||
assert res.status_code == 200
|
||||
pix_data = res.json()
|
||||
assert pix_data["success"] is True
|
||||
assert pix_data["new_item"]["id"] == "pixie_jar"
|
||||
|
||||
# Verify updated inventory contains all items
|
||||
res = client.get("/api/inventory")
|
||||
updated_inv = res.json()
|
||||
inv_ids = [item["id"] for item in updated_inv["inventory"]]
|
||||
assert "duel_badge" in inv_ids
|
||||
assert "felix_felicis" in inv_ids
|
||||
assert "cryptex_key" in inv_ids
|
||||
assert "pixie_jar" in inv_ids
|
||||
assert updated_inv["brew_solved"] is True
|
||||
assert updated_inv["cryptex_solved"] is True
|
||||
assert updated_inv["pixies_solved"] is True
|
||||
|
||||
# Test API Bottles drink: Ahead / Black fire (Bottle 3 - Dwarf, adds philosophers_stone)
|
||||
res = client.post("/api/bottles/drink", json={"bottle": 3, "gate": "ahead"})
|
||||
assert res.status_code == 200
|
||||
drink_data = res.json()
|
||||
assert drink_data["result"] == "success_ahead"
|
||||
assert "new_item" in drink_data
|
||||
assert drink_data["new_item"]["id"] == "philosophers_stone"
|
||||
|
||||
# Test API Reset
|
||||
@@ -79,7 +131,7 @@ def test_endpoints():
|
||||
assert res.status_code == 200
|
||||
assert res.json()["success"] is True
|
||||
|
||||
print("ALL TESTS (RING FLIGHT & SPELL DUEL) PASSED! ⭕🪄✨")
|
||||
print("ALL TESTS (ALL MINI-GAMES & APIS) PASSED! ⭕🪄⚗️🔐🧚🧪💎✨")
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_endpoints()
|
||||
|
||||
Reference in New Issue
Block a user