Skip to content

Commit 20ae11e

Browse files
committed
fixes
1 parent 92580ab commit 20ae11e

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

services/web/server/tests/unit/isolated/test_models.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,27 @@
66

77

88
import pytest
9+
from faker import Faker
910
from pydantic import TypeAdapter, ValidationError
1011
from pytest_simcore.helpers.faker_factories import random_phone_number
1112
from simcore_service_webserver.users._controller.rest._rest_schemas import (
1213
MyPhoneRegister,
1314
PhoneNumberStr,
1415
)
1516

17+
multiple_format_valid_phone_numbers = [
18+
"+41763456789",
19+
"+19104630364",
20+
"+1 301-304-4567",
21+
] + [
22+
# tests hand-made random_phone_number
23+
# WARNING: keed constant since pytest-xdist will run this test in parallel
24+
random_phone_number(Faker(seed=42))
25+
for _ in range(6)
26+
]
1627

17-
@pytest.mark.parametrize(
18-
"phone",
19-
["+41763456789", "+19104630364", "+1 301-304-4567"]
20-
+ [
21-
# tests hand-made random_phone_number
22-
random_phone_number()
23-
for _ in range(6)
24-
],
25-
)
28+
29+
@pytest.mark.parametrize("phone", multiple_format_valid_phone_numbers)
2630
def test_valid_phone_numbers(phone: str):
2731
# This test is used to tune options of PhoneNumberValidator
2832
assert MyPhoneRegister.model_validate({"phone": phone}).phone == TypeAdapter(

0 commit comments

Comments
 (0)