feat: add replay server and web client
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import unittest
|
||||
|
||||
from texas_holdem_replay.server import build_game_url
|
||||
|
||||
|
||||
class ReplayServerTests(unittest.TestCase):
|
||||
def test_build_game_url_from_base_and_game_id(self) -> None:
|
||||
self.assertEqual(
|
||||
build_game_url({"base_url": ["http://127.0.0.1:8000/"], "game_id": ["game 1"]}),
|
||||
"http://127.0.0.1:8000/games/game%201",
|
||||
)
|
||||
|
||||
def test_build_game_url_accepts_full_url(self) -> None:
|
||||
self.assertEqual(
|
||||
build_game_url({"url": ["https://example.test/games/demo"]}),
|
||||
"https://example.test/games/demo",
|
||||
)
|
||||
|
||||
def test_build_game_url_rejects_non_http_url(self) -> None:
|
||||
with self.assertRaises(ValueError):
|
||||
build_game_url({"url": ["file:///tmp/game.json"]})
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user