cuenca-validations 2.1.16.dev9__py3-none-any.whl → 2.1.16.dev11__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cuenca_validations/types/enums.py +1 -0
- cuenca_validations/types/general.py +1 -0
- cuenca_validations/types/requests.py +14 -0
- cuenca_validations/version.py +1 -1
- {cuenca_validations-2.1.16.dev9.dist-info → cuenca_validations-2.1.16.dev11.dist-info}/METADATA +1 -1
- {cuenca_validations-2.1.16.dev9.dist-info → cuenca_validations-2.1.16.dev11.dist-info}/RECORD +10 -10
- tests/test_types.py +23 -0
- {cuenca_validations-2.1.16.dev9.dist-info → cuenca_validations-2.1.16.dev11.dist-info}/WHEEL +0 -0
- {cuenca_validations-2.1.16.dev9.dist-info → cuenca_validations-2.1.16.dev11.dist-info}/licenses/LICENSE +0 -0
- {cuenca_validations-2.1.16.dev9.dist-info → cuenca_validations-2.1.16.dev11.dist-info}/top_level.txt +0 -0
|
@@ -487,6 +487,13 @@ class UserRequest(BaseModel):
|
|
|
487
487
|
validate_age_requirement(curp)
|
|
488
488
|
return curp
|
|
489
489
|
|
|
490
|
+
@field_validator('profession')
|
|
491
|
+
@classmethod
|
|
492
|
+
def validate_profession(cls, profession: Profession) -> Profession:
|
|
493
|
+
if profession == Profession.otro:
|
|
494
|
+
raise ValueError('Profession "otro" is not allowed for this model')
|
|
495
|
+
return profession
|
|
496
|
+
|
|
490
497
|
|
|
491
498
|
class UserUpdateRequest(BaseModel):
|
|
492
499
|
profession: Optional[Profession] = None
|
|
@@ -517,6 +524,13 @@ class UserUpdateRequest(BaseModel):
|
|
|
517
524
|
raise ValueError('The total percentage should be 100%')
|
|
518
525
|
return beneficiaries
|
|
519
526
|
|
|
527
|
+
@field_validator('profession')
|
|
528
|
+
@classmethod
|
|
529
|
+
def validate_profession(cls, profession: Profession) -> Profession:
|
|
530
|
+
if profession == Profession.otro:
|
|
531
|
+
raise ValueError('Profession "otro" is not allowed for this model')
|
|
532
|
+
return profession
|
|
533
|
+
|
|
520
534
|
|
|
521
535
|
class UserLoginRequest(BaseRequest):
|
|
522
536
|
password: Annotated[
|
cuenca_validations/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = '2.1.16.
|
|
1
|
+
__version__ = '2.1.16.dev11'
|
{cuenca_validations-2.1.16.dev9.dist-info → cuenca_validations-2.1.16.dev11.dist-info}/RECORD
RENAMED
|
@@ -4,26 +4,26 @@ cuenca_validations/errors.py,sha256=OtM8EgiKqYdz9Hn66AbBO96orL1or7efkyt0vh0Zxbs,
|
|
|
4
4
|
cuenca_validations/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
cuenca_validations/typing.py,sha256=1QCu81IbVZZpyInjyeAuO-nF36gpT5Gi4o6V9PozuOU,204
|
|
6
6
|
cuenca_validations/validators.py,sha256=mYJDXxJVokl5jZIA4FYn8wkaMUnOxAH54t1Pfg_0kmQ,1190
|
|
7
|
-
cuenca_validations/version.py,sha256=
|
|
7
|
+
cuenca_validations/version.py,sha256=bxGMm5XXUsyFEXfPIpYbnuBcZ_6fYlSDtApDKaeiVCI,29
|
|
8
8
|
cuenca_validations/types/__init__.py,sha256=CIfqLhBxUMX5YAI-FvX9pnHB233BivGJZj1lFNddx-k,5415
|
|
9
9
|
cuenca_validations/types/card.py,sha256=UGzz8NTFAverUmdUKAK1oGHnOnjSNTpIRUm93vKSSGY,1295
|
|
10
|
-
cuenca_validations/types/enums.py,sha256=
|
|
10
|
+
cuenca_validations/types/enums.py,sha256=jFHLmHSGhvM69LrQ7Yon9FIC9ZEZBbDrbeoyIo_hs3E,20363
|
|
11
11
|
cuenca_validations/types/files.py,sha256=2CszbwF9ytXV9suFFwyDjYG4XxY8UhCjRw3HttVXXNw,269
|
|
12
|
-
cuenca_validations/types/general.py,sha256=
|
|
12
|
+
cuenca_validations/types/general.py,sha256=XcoqEORNFXwsi5XP8_Zza4XuAF-bS2QrXBipKFiEhc4,5450
|
|
13
13
|
cuenca_validations/types/helpers.py,sha256=XPiYVTLDtmBB5R1heWUy1c35zZMh7nh-BmS6rtwEltg,1379
|
|
14
14
|
cuenca_validations/types/identities.py,sha256=1wkutHzL9Gpd9oAZdyiikNxWKe5iBVAQT3TabR6YG1o,5451
|
|
15
15
|
cuenca_validations/types/morals.py,sha256=davabh5hAnFVQyM7-yCyDaT5ewXnm0cr1BtqDIwzkX8,1833
|
|
16
16
|
cuenca_validations/types/queries.py,sha256=Pp7BAPk20hzImxb5EIiy3oI8S6AeCruU-NbQpOlrWVo,5146
|
|
17
|
-
cuenca_validations/types/requests.py,sha256=
|
|
18
|
-
cuenca_validations-2.1.16.
|
|
17
|
+
cuenca_validations/types/requests.py,sha256=eVoas88FWL8x4C5lSO0aNn0zhP-LgvwJbKE1AzfGOds,22224
|
|
18
|
+
cuenca_validations-2.1.16.dev11.dist-info/licenses/LICENSE,sha256=wR76FmxBbfnQpwELkkE5iMF8sFIafEMgXLTE4N4WPTc,1063
|
|
19
19
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
20
|
tests/test_card.py,sha256=QAfRz7e11gWICPnFJZ2tiYgUsFV3C9TwzJXrDnDNXFw,1202
|
|
21
21
|
tests/test_errors.py,sha256=ixiIgEuBuzfsL5p4uCFdF32XqFRtTPF6EVhGJ0keOrI,930
|
|
22
22
|
tests/test_helpers.py,sha256=ubzpi1UXCryLQdgsT_Zm2IX-XE_4L0dnHnhLwH06xK8,748
|
|
23
23
|
tests/test_requests.py,sha256=HGKybPNlN-Vbf2Ew34csfMR5UzZdVPoX9J8eeD4yCiI,1095
|
|
24
24
|
tests/test_statement.py,sha256=IOE0rRRBgBZSJv_FLaETEyn5NzzXKMNTqgjv99GX-68,1436
|
|
25
|
-
tests/test_types.py,sha256=
|
|
26
|
-
cuenca_validations-2.1.16.
|
|
27
|
-
cuenca_validations-2.1.16.
|
|
28
|
-
cuenca_validations-2.1.16.
|
|
29
|
-
cuenca_validations-2.1.16.
|
|
25
|
+
tests/test_types.py,sha256=tq9YNF44fenQUJ6Fm6B46rLQHHtcTvfDGvcnTJLgueU,20777
|
|
26
|
+
cuenca_validations-2.1.16.dev11.dist-info/METADATA,sha256=Ixd580nQf64gfYlPR2wb3KEEftlnQgiRfAnletmZ3Gk,1601
|
|
27
|
+
cuenca_validations-2.1.16.dev11.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
28
|
+
cuenca_validations-2.1.16.dev11.dist-info/top_level.txt,sha256=4233xdOs2HtuT-GFRjcDcwK0IwdwvWdczOtk0fPB6Gw,25
|
|
29
|
+
cuenca_validations-2.1.16.dev11.dist-info/RECORD,,
|
tests/test_types.py
CHANGED
|
@@ -328,6 +328,23 @@ def test_user_request():
|
|
|
328
328
|
assert UserRequest(**request).model_dump(exclude_none=True) == request
|
|
329
329
|
|
|
330
330
|
|
|
331
|
+
def test_user_request_invalid_profession():
|
|
332
|
+
request = dict(
|
|
333
|
+
curp='ABCD920604HDFSRN03',
|
|
334
|
+
profession=Profession.otro,
|
|
335
|
+
address=dict(
|
|
336
|
+
street='calle 1',
|
|
337
|
+
ext_number='2',
|
|
338
|
+
int_number='3',
|
|
339
|
+
postal_code_id='PC2ygq9j2bS9-9tsuVawzErA',
|
|
340
|
+
),
|
|
341
|
+
phone_verification_id='VE12345678',
|
|
342
|
+
email_verification_id='VE0987654321',
|
|
343
|
+
)
|
|
344
|
+
with pytest.raises(ValidationError):
|
|
345
|
+
UserRequest(**request)
|
|
346
|
+
|
|
347
|
+
|
|
331
348
|
@freeze_time('2022-01-01')
|
|
332
349
|
def test_user_request_underage():
|
|
333
350
|
request = dict(
|
|
@@ -419,6 +436,7 @@ def test_user_update_request():
|
|
|
419
436
|
),
|
|
420
437
|
],
|
|
421
438
|
curp_document_uri='https://sandbox.cuenca.com/files/EF123',
|
|
439
|
+
profession=Profession.empleado,
|
|
422
440
|
)
|
|
423
441
|
update_req = UserUpdateRequest(**request)
|
|
424
442
|
beneficiaries = [b.model_dump() for b in update_req.beneficiaries]
|
|
@@ -427,6 +445,7 @@ def test_user_update_request():
|
|
|
427
445
|
update_req.curp_document_uri.unicode_string()
|
|
428
446
|
== request['curp_document_uri']
|
|
429
447
|
)
|
|
448
|
+
assert update_req.profession == Profession.empleado
|
|
430
449
|
|
|
431
450
|
request['beneficiaries'] = [
|
|
432
451
|
dict(
|
|
@@ -490,6 +509,10 @@ def test_user_update_request():
|
|
|
490
509
|
)
|
|
491
510
|
UserUpdateRequest(**kyc_request)
|
|
492
511
|
|
|
512
|
+
request['profession'] = Profession.otro
|
|
513
|
+
with pytest.raises(ValidationError) as v:
|
|
514
|
+
UserUpdateRequest(**request)
|
|
515
|
+
|
|
493
516
|
|
|
494
517
|
def test_session_request():
|
|
495
518
|
data = dict(
|
{cuenca_validations-2.1.16.dev9.dist-info → cuenca_validations-2.1.16.dev11.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|
{cuenca_validations-2.1.16.dev9.dist-info → cuenca_validations-2.1.16.dev11.dist-info}/top_level.txt
RENAMED
|
File without changes
|