last changes (#1334)
This commit is contained in:
@@ -10,7 +10,8 @@ from BOT.match_logs import build_event_log, build_match_logs
|
||||
def _game():
|
||||
return {
|
||||
"_id": "abc",
|
||||
"winner": "[WIN]", "loser": "[LOS]",
|
||||
"winner": "1", "loser": "2",
|
||||
"tss": {"1": {"name": "TeamWin"}, "2": {"name": "TeamLose"}},
|
||||
"players": {
|
||||
"1": {"name": "alice", "tag": "[WIN]", "team": "1",
|
||||
"units": [{"unit": "ussr_t_34", "used": True}],
|
||||
@@ -31,14 +32,14 @@ def _game():
|
||||
|
||||
def test_chat_log_format():
|
||||
chat, _ = build_match_logs(_game())
|
||||
assert chat == ["[01:05] [ALL] [WIN] `alice`: gg"]
|
||||
assert chat == ["+[01:05] [ALL] [TeamWin] `alice`: gg"]
|
||||
|
||||
|
||||
def test_battle_log_kill_prefix_and_text():
|
||||
_, battle = build_match_logs(_game())
|
||||
assert len(battle) == 1
|
||||
line = battle[0]
|
||||
assert line.startswith("+[01:00] [WIN]")
|
||||
assert line.startswith("+[01:00] [TeamWin]")
|
||||
assert "alice" in line and "destroyed" in line and "bob" in line
|
||||
|
||||
|
||||
@@ -57,6 +58,7 @@ def test_event_log_preserves_kill_victim_unit():
|
||||
event_log = build_event_log(_game())
|
||||
assert event_log["kills"][0]["offended_uid"] == 2
|
||||
assert event_log["kills"][0]["offended_unit"] == "germ_pz_iv"
|
||||
assert event_log["chat"][0]["message"] == "gg"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user