def test_rm_user_from_game(self): game, _ = Game.create_new_game(self.aMap.id, self.user) # Perform the join logic _, _, player_id = Game.add_user_to_game(game.id, self.joiner) # Perform the removing logic players_json = Game.rm_user_from_game(game.id, 1) # Check a bunch of conditions self.assertEqual(len(players_json), 3) self.assertEqual(players_json[0], "hosting_player") self.assertEqual(players_json[1], "")
def on_leave(self): game_id = self.session['game_id'] self.leave(str(game_id)) Game.rm_user_from_game(game_id, self.session['player_id']) self.broadcast_message('leave', {})