Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add test for user names utils
fowczarekc5637fd36bbb
diff --git a/tests/test_account.py b/tests/test_account.pyindex cb7bc65904..9e1b713669 100644--- a/tests/test_account.py+++ b/tests/test_account.py@@ -3,9 +3,8 @@ import uuidfrom unittest.mock import patchfrom urllib.parse import urlencode-import pytest-import i18naddress+import pytestfrom captcha import constants as recaptcha_constantsfrom django.core.exceptions import ValidationErrorfrom django.forms import Form@@ -17,6 +16,7 @@ from saleor.account import forms, i18nfrom saleor.account.forms import FormWithReCaptcha, NameFormfrom saleor.account.models import Userfrom saleor.account.templatetags.i18n_address_tags import format_address+from saleor.account.utils import get_user_first_name, get_user_last_namefrom saleor.account.validators import validate_possible_number@@ -256,6 +256,34 @@ def test_get_full_name(email, first_name, last_name, full_name, address):assert user.get_full_name() == full_name+ "first_name, default_billing_address_first_name, result", [+ ('John', 'Arnold', 'John'),+ ('John', '', 'John'),+ ('', 'Arnold', 'Arnold'),+ ('', '', '')])+def test_get_user_first_name(first_name, default_billing_address_first_name,+ result, address):+ copied_address = address.get_copy()+ copied_address.first_name = default_billing_address_first_name+ user = User(first_name=first_name, default_billing_address=copied_address)+ assert get_user_first_name(user) == result+++ "last_name, default_billing_address_last_name, result", [+ ('Doe', 'Green', 'Doe'),+ ('Doe', '', 'Doe'),+ ('', 'Green', 'Green'),+ ('', '', '')])+def test_get_user_last_name(last_name, default_billing_address_last_name,+ result, address):+ copied_address = address.get_copy()+ copied_address.last_name = default_billing_address_last_name+ user = User(last_name=last_name, default_billing_address=copied_address)+ assert get_user_last_name(user) == result++def test_disabled_recaptcha():"""This test creates a new form that should not contain any recaptcha field.