From 4fa06c0236d998bef94270ffad2d0751ef08f444 Mon Sep 17 00:00:00 2001 From: Taras Lytvynenko <69678257+Inferato@users.noreply.github.com> Date: Tue, 14 Nov 2023 20:25:00 +0200 Subject: [PATCH] test: test for length validation --- .../djangoapps/user_api/accounts/tests/test_api.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/openedx/core/djangoapps/user_api/accounts/tests/test_api.py b/openedx/core/djangoapps/user_api/accounts/tests/test_api.py index 569ec98466..367d73d8c9 100644 --- a/openedx/core/djangoapps/user_api/accounts/tests/test_api.py +++ b/openedx/core/djangoapps/user_api/accounts/tests/test_api.py @@ -34,7 +34,8 @@ from openedx.core.djangoapps.ace_common.tests.mixins import EmailTemplateTagMixi from openedx.core.djangoapps.user_api.accounts import PRIVATE_VISIBILITY from openedx.core.djangoapps.user_api.accounts.api import ( get_account_settings, - update_account_settings + update_account_settings, + get_name_validation_error ) from openedx.core.djangoapps.user_api.accounts.tests.retirement_helpers import ( # pylint: disable=unused-import RetirementTestCase, @@ -570,6 +571,13 @@ class TestAccountApi(UserSettingsEventTestMixin, EmailTemplateTagMixin, CreateAc assert account_settings['country'] is None assert account_settings['state'] is None + def test_get_name_validation_error_too_long(): + """ + Test validation error when the name is too long. + """ + result = get_name_validation_error("A" * 256) + assert result == 'Full name can`t be longer than 255 symbols' + @patch('openedx.core.djangoapps.user_api.accounts.image_helpers._PROFILE_IMAGE_SIZES', [50, 10]) @patch.dict(