Ejemplo n.º 1
0
def test_create_string_patches(mock_stk_create_hints: MagicMock,
                               mock_stk_hide_hints: MagicMock,
                               mock_item_create_hints: MagicMock,
                               stk_mode: SkyTempleKeyHintMode,
                               ):
    # Setup
    game = MagicMock()
    patches = MagicMock()
    rng = MagicMock()
    mock_item_create_hints.return_value = ["item", "hints"]
    mock_stk_create_hints.return_value = ["show", "hints"]
    mock_stk_hide_hints.return_value = ["hide", "hints"]

    # Run
    result = patcher_file._create_string_patches(HintConfiguration(sky_temple_keys=stk_mode),
                                                 game,
                                                 patches,
                                                 rng)

    # Assert
    expected_result = ["item", "hints"]
    mock_item_create_hints.assert_called_once_with(patches, game.world_list, rng)

    if stk_mode == SkyTempleKeyHintMode.DISABLED:
        mock_stk_hide_hints.assert_called_once_with()
        mock_stk_create_hints.assert_not_called()
        expected_result.extend(["hide", "hints"])

    else:
        mock_stk_create_hints.assert_called_once_with(patches, game.world_list,
                                                      stk_mode == SkyTempleKeyHintMode.HIDE_AREA)
        mock_stk_hide_hints.assert_not_called()
        expected_result.extend(["show", "hints"])

    assert result == expected_result
Ejemplo n.º 2
0
def test_create_string_patches(
    mock_stk_create_hints: MagicMock,
    mock_stk_hide_hints: MagicMock,
    mock_item_create_hints: MagicMock,
    mock_logbook_title_string_patches: MagicMock,
    stk_mode: SkyTempleKeyHintMode,
):
    # Setup
    game = MagicMock()
    all_patches = MagicMock()
    rng = MagicMock()
    mock_item_create_hints.return_value = ["item", "hints"]
    mock_stk_create_hints.return_value = ["show", "hints"]
    mock_stk_hide_hints.return_value = ["hide", "hints"]
    player_config = PlayersConfiguration(0, {0: "you"})
    mock_logbook_title_string_patches.return_values = []

    # Run
    result = patcher_file._create_string_patches(
        HintConfiguration(sky_temple_keys=stk_mode),
        game,
        all_patches,
        player_config,
        rng,
    )

    # Assert
    expected_result = ["item", "hints"]
    mock_item_create_hints.assert_called_once_with(
        all_patches[player_config.player_index], game.world_list, rng)
    mock_logbook_title_string_patches.assert_called_once_with()

    if stk_mode == SkyTempleKeyHintMode.DISABLED:
        mock_stk_hide_hints.assert_called_once_with()
        mock_stk_create_hints.assert_not_called()
        expected_result.extend(["hide", "hints"])

    else:
        mock_stk_create_hints.assert_called_once_with(
            all_patches, player_config, game.world_list,
            stk_mode == SkyTempleKeyHintMode.HIDE_AREA)
        mock_stk_hide_hints.assert_not_called()
        expected_result.extend(["show", "hints"])

    assert result == expected_result