Add Player Menu with Inventory drawer, house selection, and mobile-first header

This commit is contained in:
Maxi
2026-09-22 19:02:07 +02:00
parent c5c0bad3e6
commit 9f5e5085ec
9 changed files with 1076 additions and 182 deletions
+25 -19
View File
@@ -9,6 +9,7 @@ def test_endpoints():
res = client.get("/")
assert res.status_code == 200, f"Index failed: {res.status_code}"
assert "Die Kammern des Steins der Weisen" in res.text
assert "Zauberer-Cockpit" in res.text
res = client.get("/broom")
assert res.status_code == 200
@@ -26,38 +27,43 @@ def test_endpoints():
assert res.status_code == 200
assert "ESCAPE GEMEISTERT" in res.text
# Test API Broom complete
# Test Inventory API
res = client.get("/api/inventory")
assert res.status_code == 200
inv_data = res.json()
assert "inventory" in inv_data
assert len(inv_data["inventory"]) >= 3
item_ids = [item["id"] for item in inv_data["inventory"]]
assert "wand" in item_ids
assert "broom" in item_ids
assert "snape_scroll" in item_ids
# Test House API
res = client.post("/api/player/house", json={"house": "slytherin"})
assert res.status_code == 200
assert res.json()["house"]["name"] == "Slytherin"
# Test API Broom complete (adds silver_key)
res = client.post("/api/broom/complete", json={"score": 500, "time_taken": 25})
assert res.status_code == 200
data = res.json()
assert data["success"] is True
assert "silver_key" in data["state"]["inventory"]
# Test API Bottles drink: Poison (Bottle 1)
res = client.post("/api/bottles/drink", json={"bottle": 1, "gate": "ahead"})
assert res.status_code == 200
assert res.json()["result"] == "poison"
# Test API Bottles drink: Wine (Bottle 2)
res = client.post("/api/bottles/drink", json={"bottle": 2, "gate": "ahead"})
assert res.status_code == 200
assert res.json()["result"] == "wine"
# Test API Bottles drink: Back (Bottle 7)
res = client.post("/api/bottles/drink", json={"bottle": 7, "gate": "back"})
assert res.status_code == 200
assert res.json()["result"] == "success_back"
# Test API Bottles drink: Ahead / Black fire (Bottle 3 - Dwarf)
# 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
assert res.json()["result"] == "success_ahead"
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
res = client.post("/api/reset")
assert res.status_code == 200
assert res.json()["success"] is True
print("ALL TESTS PASSED SUCCESSFULLY! 🧙‍♂️✨")
print("ALL INVENTORY & GAMEPLAY TESTS PASSED! 🎒✨")
if __name__ == "__main__":
test_endpoints()