shortdeck1.0

This commit is contained in:
2025-09-30 18:09:49 +08:00
commit ee95b8e049
24 changed files with 532 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
from __future__ import annotations
import json
from fastapi.testclient import TestClient
from shortdeck_server.main import app
client = TestClient(app)
def pretty(o):
print(json.dumps(o, ensure_ascii=False, indent=2))
def run():
print('POST /join aa')
r = client.post('/join', json={'name':'aa'})
pretty(r.json())
print('POST /join bb')
r = client.post('/join', json={'name':'bb'})
pretty(r.json())
print('GET /get_game_state?player_id=0')
r = client.get('/get_game_state', params={'player_id':0})
pretty(r.json())
print('POST /apply_action check by pid=0')
r = client.post('/apply_action', json={'player_id':0, 'action':'check'})
pretty(r.json())
print('POST /apply_action bet 10 by pid=1')
r = client.post('/apply_action', json={'player_id':1, 'action':'bet', 'amount':10})
pretty(r.json())
if __name__ == '__main__':
run()