import pytest
from unittest.mock import patch, MagicMock
from app.functions.get_score_list import get_score_list


@patch('app.functions.get_score_list.roll_dices')
def test_get_score_list(mock_roll_dices):
    # Setup the mock to return a specific value
    mock_roll_dices.return_value = {'result': 50}

    # Test that the modifier is applied correctly when the roll value is less than 100 after applying modifier
    scores = get_score_list(4, 10)
    assert scores == [60, 60, 60, 60]

    # Test that the score is capped at 100
    scores = get_score_list(4, 60)
    assert scores == [100, 100, 100, 100]

    # Test that the duplicates are handled You may need to setup some specific behavior on your mock object. Here we
    # are making it return 50 on the first call, and 60 on any subsequent calls. This simulates a scenario where
    # get_score_list may returns duplicate value
    mock_roll_dices.side_effect = [{'result': 50}, {'result': 60}]
    scores = get_score_list(2, 10)
    assert scores == [60, 70]
