예제 #1
0
async def test_handle_action_GameOption(game: Game,
                                        game_connection: GameConnection):
    game.gameOptions = {"AIReplacement": "Off"}
    await game_connection.handle_action('GameOption', ['Victory', 'sandbox'])
    assert game.gameOptions['Victory'] == Victory.SANDBOX
    await game_connection.handle_action('GameOption',
                                        ['AIReplacement', 'AIReplacementOn'])
    assert game.gameOptions['AIReplacement'] == 'On'
    await game_connection.handle_action('GameOption', ['Slots', '7'])
    assert game.max_players == 7
    # I don't know what these paths actually look like
    await game_connection.handle_action('GameOption',
                                        ['ScenarioFile', 'C:\\Maps\\Some_Map'])
    assert game.map_file_path == "maps/some_map.zip"
    await game_connection.handle_action('GameOption', ['Title', 'All welcome'])
    assert game.name == game.sanitize_name('All welcome')
예제 #2
0
async def test_handle_action_GameOption(game: Game,
                                        game_connection: GameConnection):
    game.gameOptions = {"AIReplacement": "Off"}
    await game_connection.handle_action("GameOption", ["Victory", "sandbox"])
    assert game.gameOptions["Victory"] == Victory.SANDBOX
    await game_connection.handle_action("GameOption", ["AIReplacement", "On"])
    assert game.gameOptions["AIReplacement"] == "On"
    await game_connection.handle_action("GameOption", ["Slots", "7"])
    assert game.max_players == 7
    # I don't know what these paths actually look like
    await game_connection.handle_action("GameOption",
                                        ["ScenarioFile", "C:\\Maps\\Some_Map"])
    assert game.map_file_path == "maps/some_map.zip"
    await game_connection.handle_action("GameOption", ["Title", "All welcome"])
    assert game.name == game.sanitize_name("All welcome")
    await game_connection.handle_action("GameOption",
                                        ["ArbitraryKey", "ArbitraryValue"])
    assert game.gameOptions["ArbitraryKey"] == "ArbitraryValue"
예제 #3
0
async def test_handle_action_GameOption_not_host(
        game: Game, game_connection: GameConnection, players):
    game_connection.player = players.joining
    game.gameOptions = {"Victory": "asdf"}
    await game_connection.handle_action('GameOption', ['Victory', 'sandbox'])
    assert game.gameOptions == {"Victory": "asdf"}