import pytest
from unittest.mock import patch
from app.functions.generate_profile import generate_profile


@patch('app.functions.generate_profile.get_sex', return_value='male')
@patch('app.functions.generate_profile.get_age', return_value=30)
@patch('app.functions.generate_profile.get_hair', return_value='black')
@patch('app.functions.generate_profile.get_eyes', return_value='blue')
@patch('app.functions.generate_profile.get_skin_tone', return_value='dark')
@pytest.mark.parametrize("chartype", ["human", "humanoid", "mutant", "cyborg"])
def test_generate_profile(
        mock_get_skin_tone, mock_get_eyes, mock_get_hair, mock_get_age, mock_get_sex, chartype):
    profile = generate_profile(chartype)

    # Assertions common to all character types
    assert profile["name"] == 'Anon'
    assert profile["sex"] == 'male'
    assert profile["age"] == 30

    # Additional assertions for 'human' character type
    if chartype == 'human':
        assert profile["hair"] == 'black'
        assert profile["eyes"] == 'blue'
        assert profile["skintone"] == 'dark'
    else:
        # 'hair', 'eyes' and 'skintone' should not exist for non-human types
        assert "hair" not in profile
        assert "eyes" not in profile
        assert "skintone" not in profile
