32 lines
1021 B
Python
32 lines
1021 B
Python
import pathlib
|
|
import sys
|
|
|
|
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
|
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[2] / "SHARED"))
|
|
|
|
from BOT.transform import build_scoreboard_model
|
|
|
|
|
|
def _game():
|
|
return {
|
|
"_id": "abc",
|
|
"winner": "1",
|
|
"mission_name": "Kursk",
|
|
"tss": {
|
|
"tournament_id": 24965,
|
|
"tournament_name": "2x2 RBm Tanks",
|
|
"1": {"team_id": "111", "team_name": "A", "players": [{"uid": "1", "pvp_ratio": 1500}]},
|
|
"2": {"team_id": "222", "team_name": "B", "players": [{"uid": "2", "pvp_ratio": 1400}]},
|
|
},
|
|
"players": {
|
|
"1": {"name": "alice", "team": "1", "units": [{"unit": "t34", "used": True}]},
|
|
"2": {"name": "bob", "team": "2", "units": [{"unit": "pz", "used": True}]},
|
|
},
|
|
}
|
|
|
|
|
|
def test_model_carries_tournament_id():
|
|
model = build_scoreboard_model(_game())
|
|
assert model is not None
|
|
assert model["tournament_id"] == 24965
|