Skip to content

Commit

Permalink
Merge branch 'develop' into feature/FAForever#727-refactor-matchmaker…
Browse files Browse the repository at this point in the history
…-for-4v4-party-algorithm
  • Loading branch information
Askaholic authored Jul 24, 2021
2 parents d9a314f + 0009ba8 commit 3bb3125
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
- cron: '0 0 * * *'

env:
FAF_DB_VERSION: v112
FAF_DB_VERSION: v119
FLYWAY_VERSION: 7.5.4

jobs:
Expand Down
2 changes: 1 addition & 1 deletion server/games/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ def to_dict(self):
player.login for player in self.players
if self.get_player_option(player.id, "Team") == team
]
for team in self.teams
for team in self.teams if team is not None
}
}

Expand Down
3 changes: 0 additions & 3 deletions tests/data/test-data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ DELETE FROM uniqueid;
DELETE FROM global_rating;
DELETE FROM ladder1v1_rating;
DELETE FROM uniqueid_exempt;
DELETE FROM version_lobby;
DELETE FROM friends_and_foes;
DELETE FROM ladder_map;
DELETE FROM tutorial;
Expand Down Expand Up @@ -40,7 +39,6 @@ DELETE FROM game_stats;
DELETE FROM game_featuredMods;
DELETE FROM ladder_division_score;
DELETE FROM ladder_division;
DELETE FROM lobby_admin;
DELETE FROM name_history;
DELETE FROM user_group_assignment;
DELETE FROM login;
Expand Down Expand Up @@ -108,7 +106,6 @@ insert into group_permission_assignment (id, group_id, permission_id) values
(3, (SELECT id from user_group WHERE technical_name = 'faf_server_administrators'), (SELECT id from group_permission WHERE technical_name = 'ADMIN_JOIN_CHANNEL')),
(4, (SELECT id from user_group WHERE technical_name = 'faf_moderators_global'), (SELECT id from group_permission WHERE technical_name = 'ADMIN_KICK_SERVER'));

insert into lobby_admin (user_id, `group`) values (1, 2);
insert into user_group_assignment(user_id, group_id) values (1, (SELECT id from user_group WHERE technical_name = 'faf_server_administrators'));
insert into user_group_assignment(user_id, group_id) values (2, (SELECT id from user_group WHERE technical_name = 'faf_moderators_global'));
insert into user_group_assignment(user_id, group_id) values (20, (SELECT id from user_group WHERE technical_name = 'faf_moderators_global'));
Expand Down
15 changes: 14 additions & 1 deletion tests/unit_tests/test_game.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,19 @@ async def test_game_visible_for_rating(game: Game, players):
assert game.is_visible_to_player(players.joining)


async def test_player_team_is_none(game, players, mock_game_connection):
game.state = GameState.LOBBY
mock_game_connection.player = players.hosting
mock_game_connection.state = GameConnectionState.CONNECTED_TO_HOST
game.add_game_connection(mock_game_connection)
game.set_player_option(players.hosting.id, "Army", 0)
assert game.players == {players.hosting}
assert game.get_player_option(players.hosting.id, "Team") is None
assert game.get_player_option(players.hosting.id, "Army") == 0
assert game.teams == {None}
assert game.to_dict()["teams"] == {}


async def test_set_player_option(game, players, mock_game_connection):
game.state = GameState.LOBBY
mock_game_connection.player = players.hosting
Expand All @@ -305,7 +318,7 @@ async def test_set_player_option(game, players, mock_game_connection):
assert game.get_player_option(players.hosting.id, "Team") == 1
assert game.teams == {1}
game.set_player_option(players.hosting.id, "StartSpot", 1)
game.get_player_option(players.hosting.id, "StartSpot") == 1
assert game.get_player_option(players.hosting.id, "StartSpot") == 1


async def test_invalid_get_player_option_key(game: Game, players):
Expand Down

0 comments on commit 3bb3125

Please sign in to comment.