Skip to content

Commit 4b54e65

Browse files
committed
test: use Bram Poker challenge as test_rearrange_consumeables setup
1 parent 9106acf commit 4b54e65

File tree

1 file changed

+10
-74
lines changed

1 file changed

+10
-74
lines changed

tests/lua/endpoints/test_rearrange_consumeables.py

Lines changed: 10 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import pytest
55

6-
from balatrobot.enums import ErrorCode, State
6+
from balatrobot.enums import ErrorCode
77

88
from ..conftest import assert_error_response, send_and_receive_api_message
99

@@ -16,85 +16,21 @@ def setup_and_teardown(
1616
self, tcp_client: socket.socket
1717
) -> Generator[dict, None, None]:
1818
"""Start a run, reach shop phase, buy consumables, then enter selecting hand phase."""
19-
# Start a run with specific seed
20-
send_and_receive_api_message(
21-
tcp_client,
22-
"start_run",
23-
{"deck": "Red Deck", "seed": "OOOO155", "stake": 1},
24-
)
25-
26-
# Select blind to enter selecting hand state
27-
send_and_receive_api_message(
28-
tcp_client, "skip_or_select_blind", {"action": "select"}
29-
)
30-
31-
# Play hand to progress
32-
send_and_receive_api_message(
33-
tcp_client,
34-
"play_hand_or_discard",
35-
{"action": "play_hand", "cards": [0, 1, 2, 3]},
36-
)
37-
38-
# Cash out to enter shop
39-
send_and_receive_api_message(tcp_client, "cash_out", {})
40-
41-
# Buy first consumable card (usually index 1 is a planet/tarot card)
42-
game_state = send_and_receive_api_message(
43-
tcp_client, "shop", {"index": 1, "action": "buy_card"}
44-
)
45-
46-
# Go to next round to enter selecting hand state with consumables
47-
send_and_receive_api_message(tcp_client, "shop", {"action": "next_round"})
48-
49-
game_state = send_and_receive_api_message(
50-
tcp_client, "skip_or_select_blind", {"action": "select"}
51-
)
52-
53-
# add the other setup from the comment above
54-
55-
game_state = send_and_receive_api_message(
56-
tcp_client,
57-
"play_hand_or_discard",
58-
{"action": "discard", "cards": [0, 1, 2, 3, 4]},
59-
)
60-
game_state = send_and_receive_api_message(
61-
tcp_client,
62-
"play_hand_or_discard",
63-
{"action": "discard", "cards": [4, 5, 6, 7]},
64-
)
6519
game_state = send_and_receive_api_message(
6620
tcp_client,
67-
"play_hand_or_discard",
68-
{"action": "play_hand", "cards": [2, 3, 4, 5, 6]},
69-
)
70-
game_state = send_and_receive_api_message(
71-
tcp_client,
72-
"play_hand_or_discard",
73-
{"action": "discard", "cards": [1, 2, 3, 6]},
74-
)
75-
game_state = send_and_receive_api_message(
76-
tcp_client,
77-
"play_hand_or_discard",
78-
{"action": "play_hand", "cards": [0, 3, 4, 5, 6]},
79-
)
80-
81-
send_and_receive_api_message(tcp_client, "cash_out", {})
82-
83-
game_state = send_and_receive_api_message(
84-
tcp_client, "shop", {"action": "reroll"}
85-
)
86-
game_state = send_and_receive_api_message(
87-
tcp_client, "shop", {"action": "reroll"}
88-
)
89-
90-
game_state = send_and_receive_api_message(
91-
tcp_client, "shop", {"index": 1, "action": "buy_card"}
21+
"start_run",
22+
{
23+
"deck": "Red Deck",
24+
"seed": "OOOO155",
25+
"stake": 1,
26+
"challenge": "Bram Poker", # it starts with two consumable
27+
},
9228
)
9329

94-
assert game_state["state"] == State.SHOP.value
9530
assert len(game_state["consumeables"]["cards"]) == 2
9631

9732
yield game_state
33+
9834
send_and_receive_api_message(tcp_client, "go_to_menu", {})
9935

10036
# ------------------------------------------------------------------
@@ -269,7 +205,7 @@ def test_rearrange_consumeables_no_consumeables_available(
269205
send_and_receive_api_message(tcp_client, "go_to_menu", {})
270206

271207
def test_rearrange_consumeables_missing_required_field(
272-
self, tcp_client: socket.socket, setup_and_teardown: dict
208+
self, tcp_client: socket.socket
273209
) -> None:
274210
"""Calling rearrange_consumeables without the consumeables field should error."""
275211
response = send_and_receive_api_message(

0 commit comments

Comments
 (0)