Add optional asso pigliatutto rule with a lobby toggle
CI / Build and push docker image (push) Successful in 3m16s
CI / Build and push docker image (push) Successful in 3m16s
An ace played when no equal rank is on the table sweeps the whole table; the sweep never scores a scopa, and an ace already on the table still forces the mandatory equal-rank capture. The rule is off by default, selectable per match via the schema-driven creation form, and announced in the game view.
This commit is contained in:
@@ -94,6 +94,28 @@ class GamesRouteTest(unittest.TestCase):
|
||||
)
|
||||
self.assertEqual(400, invalid.status_code)
|
||||
|
||||
@async_test
|
||||
async def test_create_asso_pigliatutto_option(self) -> None:
|
||||
transport = ASGITransport(app=app)
|
||||
async with AsyncClient(transport=transport, base_url="http://127.0.0.1") as client:
|
||||
with oidc_user("alice"):
|
||||
default = await client.post("/api/games", json={})
|
||||
self.assertEqual(201, default.status_code)
|
||||
self.assertFalse(default.json()["asso_pigliatutto"])
|
||||
|
||||
with oidc_user("alice"):
|
||||
enabled = await client.post(
|
||||
"/api/games", json={"options": {"asso_pigliatutto": True}}
|
||||
)
|
||||
self.assertEqual(201, enabled.status_code)
|
||||
self.assertTrue(enabled.json()["asso_pigliatutto"])
|
||||
|
||||
with oidc_user("alice"):
|
||||
invalid = await client.post(
|
||||
"/api/games", json={"options": {"asso_pigliatutto": "yes"}}
|
||||
)
|
||||
self.assertEqual(400, invalid.status_code)
|
||||
|
||||
@async_test
|
||||
async def test_join_errors(self) -> None:
|
||||
transport = ASGITransport(app=app)
|
||||
@@ -163,6 +185,9 @@ class GameTypesRouteTest(unittest.TestCase):
|
||||
self.assertEqual(4, results[0]["max_players"])
|
||||
self.assertIn("target_score", results[0]["options_schema"]["properties"])
|
||||
self.assertIn("napola", results[0]["options_schema"]["properties"])
|
||||
self.assertIn(
|
||||
"asso_pigliatutto", results[0]["options_schema"]["properties"]
|
||||
)
|
||||
|
||||
@async_test
|
||||
async def test_create_defaults_game_type(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user