Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add test for validate_possible_number
akjanik0623a62ed3b6
diff --git a/tests/test_userprofile.py b/tests/test_userprofile.pyindex 4779c2b24f..7baaf9d01f 100644--- a/tests/test_userprofile.py+++ b/tests/test_userprofile.py@@ -10,9 +10,11 @@ except ImportError:import i18naddressimport pytest+from django.core.exceptions import ValidationErrorfrom django.http import QueryDictfrom saleor.userprofile import forms, models, i18n+from saleor.userprofile.validators import validate_possible_number@pytest.fixturedef billing_address(db):@@ -107,3 +109,18 @@ def test_country_aware_form_has_only_supported_countries():for country in i18n.UNKNOWN_COUNTRIES:assert country not in i18n.COUNTRY_FORMSassert country not in country_choices++[email protected]("input,exception", [+ ('123', ValidationError),+ ('+48123456789', None),+ ('+12025550169', None),+ ('+481234567890', ValidationError),+ ('testext', ValidationError),+])+def test_validate_possible_number(input, exception):+ if exception is not None:+ with pytest.raises(exception):+ validate_possible_number(input)+ else:+ validate_possible_number(input)