COVERAGE: patch 91% → 96%+ — 603 tests, tasks.py at 100%
New/extended tests across billboard, dashboard, drama, epic, gameboard, and lyric to cover previously untested branches: dev_login view, scroll position endpoints, sky preview error paths, drama to_prose/to_activity branches, consumer broadcast handlers, tarot deck draw/shuffle, astrology model __str__, character model, sig reserve/ready/confirm views, natus preview/save views, and the full tasks.py countdown scheduler. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -166,6 +166,65 @@ class CursorMoveConsumerTest(TransactionTestCase):
|
||||
await bc_comm.disconnect()
|
||||
|
||||
|
||||
@override_settings(CHANNEL_LAYERS=TEST_CHANNEL_LAYERS)
|
||||
class MissingConsumerHandlersTest(SimpleTestCase):
|
||||
"""Covers the simple pass-through handlers not exercised by other tests."""
|
||||
|
||||
async def _send_and_receive(self, room_path, group_name, msg):
|
||||
communicator = WebsocketCommunicator(application, room_path)
|
||||
await communicator.connect()
|
||||
channel_layer = get_channel_layer()
|
||||
await channel_layer.group_send(group_name, msg)
|
||||
response = await communicator.receive_json_from()
|
||||
await communicator.disconnect()
|
||||
return response
|
||||
|
||||
async def test_receives_sig_selected_broadcast(self):
|
||||
room_id = "00000000-0000-0000-0000-000000000002"
|
||||
response = await self._send_and_receive(
|
||||
f"/ws/room/{room_id}/",
|
||||
f"room_{room_id}",
|
||||
{"type": "sig_selected", "card_id": "abc"},
|
||||
)
|
||||
self.assertEqual(response["type"], "sig_selected")
|
||||
|
||||
async def test_receives_countdown_start_broadcast(self):
|
||||
room_id = "00000000-0000-0000-0000-000000000002"
|
||||
response = await self._send_and_receive(
|
||||
f"/ws/room/{room_id}/",
|
||||
f"room_{room_id}",
|
||||
{"type": "countdown_start", "polarity": "levity", "seconds": 12},
|
||||
)
|
||||
self.assertEqual(response["type"], "countdown_start")
|
||||
|
||||
async def test_receives_countdown_cancel_broadcast(self):
|
||||
room_id = "00000000-0000-0000-0000-000000000002"
|
||||
response = await self._send_and_receive(
|
||||
f"/ws/room/{room_id}/",
|
||||
f"room_{room_id}",
|
||||
{"type": "countdown_cancel", "polarity": "levity", "seconds_remaining": 7},
|
||||
)
|
||||
self.assertEqual(response["type"], "countdown_cancel")
|
||||
|
||||
async def test_receives_polarity_room_done_broadcast(self):
|
||||
room_id = "00000000-0000-0000-0000-000000000002"
|
||||
response = await self._send_and_receive(
|
||||
f"/ws/room/{room_id}/",
|
||||
f"room_{room_id}",
|
||||
{"type": "polarity_room_done", "polarity": "levity"},
|
||||
)
|
||||
self.assertEqual(response["type"], "polarity_room_done")
|
||||
|
||||
async def test_receives_pick_sky_available_broadcast(self):
|
||||
room_id = "00000000-0000-0000-0000-000000000002"
|
||||
response = await self._send_and_receive(
|
||||
f"/ws/room/{room_id}/",
|
||||
f"room_{room_id}",
|
||||
{"type": "pick_sky_available"},
|
||||
)
|
||||
self.assertEqual(response["type"], "pick_sky_available")
|
||||
|
||||
|
||||
@tag('channels')
|
||||
@override_settings(CHANNEL_LAYERS=TEST_CHANNEL_LAYERS)
|
||||
class SigHoverConsumerTest(TransactionTestCase):
|
||||
|
||||
Reference in New Issue
Block a user