コード例 #1
0
async def test_validate_game_settings_coop(coop_game: Game):
    settings = [
        ('Victory', Victory.DEMORALIZATION, ValidityState.WRONG_VICTORY_CONDITION),
        ('TeamSpawn', 'open', ValidityState.SPAWN_NOT_FIXED),
        ('RevealedCivilians', 'Yes', ValidityState.CIVILIANS_REVEALED),
        ('Difficulty', 1, ValidityState.WRONG_DIFFICULTY),
        ('Expansion', 0, ValidityState.EXPANSION_DISABLED),
    ]

    await check_game_settings(coop_game, settings)

    coop_game.validity = ValidityState.VALID
    await coop_game.validate_game_settings()
    assert coop_game.validity is ValidityState.VALID
コード例 #2
0
async def test_validate_game_settings(game: Game):
    settings = [
        ('Victory', Victory.SANDBOX, ValidityState.WRONG_VICTORY_CONDITION),
        ('FogOfWar', 'none', ValidityState.NO_FOG_OF_WAR),
        ('CheatsEnabled', 'true', ValidityState.CHEATS_ENABLED),
        ('PrebuiltUnits', 'On', ValidityState.PREBUILT_ENABLED),
        ('NoRushOption', 20, ValidityState.NORUSH_ENABLED),
        ('RestrictedCategories', 1, ValidityState.BAD_UNIT_RESTRICTIONS),
        ('TeamLock', 'unlocked', ValidityState.UNLOCKED_TEAMS)
    ]

    game.state = GameState.LOBBY
    add_players(game, 2)

    await check_game_settings(game, settings)

    game.validity = ValidityState.VALID
    await game.validate_game_settings()
    assert game.validity is ValidityState.VALID
コード例 #3
0
ファイル: test_game.py プロジェクト: FAForever/server
async def test_validate_game_settings(game: Game):
    settings = [
        ('Victory', Victory.SANDBOX, Victory.DEMORALIZATION, ValidityState.WRONG_VICTORY_CONDITION),
        ('FogOfWar', 'none', 'explored', ValidityState.NO_FOG_OF_WAR),
        ('CheatsEnabled', 'true', 'false', ValidityState.CHEATS_ENABLED),
        ('PrebuiltUnits', 'On', 'Off', ValidityState.PREBUILT_ENABLED),
        ('NoRushOption', 20, 'Off', ValidityState.NORUSH_ENABLED),
        ('RestrictedCategories', 1, 0, ValidityState.BAD_UNIT_RESTRICTIONS)
    ]

    for data in settings:
        key, value, default, expected = data
        game.gameOptions[key] = value
        await game.validate_game_settings()
        assert game.validity is expected
        game.gameOptions[key] = default

    game.validity = ValidityState.VALID
    await game.validate_game_settings()
    assert game.validity is ValidityState.VALID
コード例 #4
0
async def test_validate_game_settings(game: Game):
    settings = [
        ('Victory', Victory.SANDBOX, Victory.DEMORALIZATION,
         ValidityState.WRONG_VICTORY_CONDITION),
        ('FogOfWar', 'none', 'explored', ValidityState.NO_FOG_OF_WAR),
        ('CheatsEnabled', 'true', 'false', ValidityState.CHEATS_ENABLED),
        ('PrebuiltUnits', 'On', 'Off', ValidityState.PREBUILT_ENABLED),
        ('NoRushOption', 20, 'Off', ValidityState.NORUSH_ENABLED),
        ('RestrictedCategories', 1, 0, ValidityState.BAD_UNIT_RESTRICTIONS)
    ]

    for data in settings:
        key, value, default, expected = data
        game.gameOptions[key] = value
        await game.validate_game_settings()
        assert game.validity is expected
        game.gameOptions[key] = default

    game.validity = ValidityState.VALID
    await game.validate_game_settings()
    assert game.validity is ValidityState.VALID