add tss tournament stuff (#1348)
This commit is contained in:
@@ -172,6 +172,34 @@ def test_fill_names_from_battles_by_uuid():
|
||||
assert match["winner_name"] == "NUGOB"
|
||||
|
||||
|
||||
def test_fetch_battles_for_matches_concurrent(monkeypatch):
|
||||
calls = []
|
||||
|
||||
def fake_request(method, action, **params):
|
||||
calls.append((method, action, params["idMatch"]))
|
||||
return [{
|
||||
"url": "224584316650954636",
|
||||
"position": 0,
|
||||
"statusReplay": "view replay",
|
||||
"winner": "NUGOB",
|
||||
"teamA": {"teamName": "uuid-a", "realName": "NUGOB"},
|
||||
"teamB": {"teamName": "uuid-b", "realName": "GRIDAC"},
|
||||
}]
|
||||
|
||||
monkeypatch.setattr(tt, "_request", fake_request)
|
||||
matches = [{
|
||||
"match_id": "m1", "type_bracket": "Winner", "status": "played",
|
||||
"team_a_uuid": "uuid-a", "team_a_name": None,
|
||||
"team_b_uuid": "uuid-b", "team_b_name": None,
|
||||
"winner_name": None, "score_a": 1, "score_b": 0,
|
||||
}]
|
||||
battles = tt.fetch_battles_for_matches(123, matches, workers=2)
|
||||
assert len(calls) == 1
|
||||
assert battles[0]["session_hex"] == "31de23f001a9f8c"
|
||||
assert matches[0]["team_a_name"] == "NUGOB"
|
||||
assert matches[0]["team_b_name"] == "GRIDAC"
|
||||
|
||||
|
||||
def test_compute_status():
|
||||
played = [{"status": "played"}, {"status": "bye"}]
|
||||
mixed = [{"status": "played"}, {"status": "pending"}]
|
||||
|
||||
Reference in New Issue
Block a user