import pytest from app.features.checkout.service import validate_user_country_currency def test_india_allows_inr_only(): validate_user_country_currency("India", "INR") validate_user_country_currency("INDIA", "inr") validate_user_country_currency(None, "INR") validate_user_country_currency("", "INR") with pytest.raises(ValueError, match="Users with billing country India must pay in INR"): validate_user_country_currency("India", "USD") with pytest.raises(ValueError, match="Users with billing country India must pay in INR"): validate_user_country_currency("India", "EUR") def test_european_countries_allow_eur_and_usd(): for eu_country in ["Germany", "France", "Italy", "Spain", "Netherlands", "Cyprus", "Estonia"]: validate_user_country_currency(eu_country, "EUR") validate_user_country_currency(eu_country, "USD") with pytest.raises(ValueError, match="must pay in EUR or USD"): validate_user_country_currency(eu_country, "INR") def test_rest_of_world_allows_usd_only(): for country in ["United States", "Canada", "Australia", "Singapore", "United Kingdom"]: validate_user_country_currency(country, "USD") with pytest.raises(ValueError, match="INR payments are restricted"): validate_user_country_currency(country, "INR") with pytest.raises(ValueError, match="must pay in USD"): validate_user_country_currency(country, "EUR")