diff --git a/server/ladder_service.py b/server/ladder_service.py index a89714e3b..a56a6f680 100644 --- a/server/ladder_service.py +++ b/server/ladder_service.py @@ -442,7 +442,7 @@ def get_player_mean(player): def game_options(player: Player) -> GameLaunchOptions: return options._replace( team=game.get_player_option(player.id, "Team"), - faction=player.faction, + faction=player.faction.name, map_position=game.get_player_option(player.id, "StartSpot") ) diff --git a/server/types.py b/server/types.py index 75136505f..5106d6f03 100644 --- a/server/types.py +++ b/server/types.py @@ -24,7 +24,7 @@ class GameLaunchOptions(NamedTuple): mapname: Optional[str] = None team: Optional[int] = None - faction: Optional[int] = None + faction: Optional[str] = None expected_players: Optional[int] = None map_position: Optional[int] = None diff --git a/tests/integration_tests/test_matchmaker.py b/tests/integration_tests/test_matchmaker.py index ffddc2edc..0b9a8c4ac 100644 --- a/tests/integration_tests/test_matchmaker.py +++ b/tests/integration_tests/test_matchmaker.py @@ -37,7 +37,7 @@ async def test_game_launch_message(lobby_server): assert msg1["mapname"] == msg2["mapname"] assert msg1["team"] == 2 assert msg2["team"] == 3 - assert msg1["faction"] == msg2["faction"] == 1 # faction 1 is uef + assert msg1["faction"] == msg2["faction"] == "uef" assert msg1["expected_players"] == msg2["expected_players"] == 2 assert msg1["map_position"] == 1 assert msg2["map_position"] == 2 diff --git a/tests/integration_tests/test_teammatchmaker.py b/tests/integration_tests/test_teammatchmaker.py index 62f297081..e960e8f4d 100644 --- a/tests/integration_tests/test_teammatchmaker.py +++ b/tests/integration_tests/test_teammatchmaker.py @@ -9,6 +9,7 @@ leaderboard_rating, leaderboard_rating_journal ) +from server.factions import Faction from tests.utils import fast_forward from .conftest import connect_and_sign_in, read_until, read_until_command @@ -98,7 +99,7 @@ async def test_game_matchmaking(lobby_server): assert msg["expected_players"] == 4 assert msg["team"] in (2, 3) assert msg["map_position"] in (1, 2, 3, 4) - assert msg["faction"] == 1 + assert msg["faction"] == "uef" @fast_forward(15) @@ -143,7 +144,7 @@ async def test_game_matchmaking_multiqueue(lobby_server): assert msg["expected_players"] == 4 assert msg["team"] in (2, 3) assert msg["map_position"] in (1, 2, 3, 4) - assert msg["faction"] == 2 + assert msg["faction"] == "aeon" @fast_forward(10) @@ -221,7 +222,7 @@ async def test_game_matchmaking_with_parties(lobby_server): assert msg["expected_players"] == 4 assert msg["team"] in (2, 3) assert msg["map_position"] in (1, 2, 3, 4) - assert msg["faction"] == i + 1 + assert msg["faction"] == "uef" if i == 0 else "aeon" if i == 1 else "cybran" if i == 2 else "seraphim" @fast_forward(30) @@ -470,7 +471,7 @@ async def test_game_ratings(lobby_server): proto, [player_id, "Army", slot], [player_id, "Color", slot], - [player_id, "Faction", msg["faction"]], + [player_id, "Faction", Faction.from_string(msg["faction"])], [player_id, "StartSpot", slot], [player_id, "Team", msg["team"]], )