cuenca-validations 2.1.16.dev11__py3-none-any.whl → 2.1.17.dev1__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/requests.py +16 -2
- cuenca_validations/version.py +1 -1
- {cuenca_validations-2.1.16.dev11.dist-info → cuenca_validations-2.1.17.dev1.dist-info}/METADATA +1 -1
- {cuenca_validations-2.1.16.dev11.dist-info → cuenca_validations-2.1.17.dev1.dist-info}/RECORD +9 -9
- tests/test_requests.py +40 -1
- {cuenca_validations-2.1.16.dev11.dist-info → cuenca_validations-2.1.17.dev1.dist-info}/WHEEL +0 -0
- {cuenca_validations-2.1.16.dev11.dist-info → cuenca_validations-2.1.17.dev1.dist-info}/licenses/LICENSE +0 -0
- {cuenca_validations-2.1.16.dev11.dist-info → cuenca_validations-2.1.17.dev1.dist-info}/top_level.txt +0 -0
|
@@ -588,6 +588,7 @@ class SessionType(str, Enum):
|
|
|
588
588
|
account_entries = 'session.account_entries'
|
|
589
589
|
download_file = 'session.download_file'
|
|
590
590
|
upload_file = 'session.upload_file'
|
|
591
|
+
metamap_verification = 'session.metamap_verification'
|
|
591
592
|
|
|
592
593
|
|
|
593
594
|
class WebhookObject(str, Enum):
|
|
@@ -491,7 +491,7 @@ class UserRequest(BaseModel):
|
|
|
491
491
|
@classmethod
|
|
492
492
|
def validate_profession(cls, profession: Profession) -> Profession:
|
|
493
493
|
if profession == Profession.otro:
|
|
494
|
-
raise ValueError('Profession "otro" is not allowed
|
|
494
|
+
raise ValueError('Profession "otro" is not allowed')
|
|
495
495
|
return profession
|
|
496
496
|
|
|
497
497
|
|
|
@@ -528,7 +528,7 @@ class UserUpdateRequest(BaseModel):
|
|
|
528
528
|
@classmethod
|
|
529
529
|
def validate_profession(cls, profession: Profession) -> Profession:
|
|
530
530
|
if profession == Profession.otro:
|
|
531
|
-
raise ValueError('Profession "otro" is not allowed
|
|
531
|
+
raise ValueError('Profession "otro" is not allowed')
|
|
532
532
|
return profession
|
|
533
533
|
|
|
534
534
|
|
|
@@ -547,6 +547,19 @@ class SessionRequest(BaseRequest):
|
|
|
547
547
|
type: SessionType
|
|
548
548
|
success_url: Optional[SerializableAnyUrl] = None
|
|
549
549
|
failure_url: Optional[SerializableAnyUrl] = None
|
|
550
|
+
resource_id: Optional[str] = None
|
|
551
|
+
|
|
552
|
+
@model_validator(mode='before')
|
|
553
|
+
@classmethod
|
|
554
|
+
def validate_metadata(cls, values: dict) -> dict:
|
|
555
|
+
if values[
|
|
556
|
+
'type'
|
|
557
|
+
] == SessionType.metamap_verification and not values.get(
|
|
558
|
+
'resource_id'
|
|
559
|
+
):
|
|
560
|
+
raise ValueError('Resource id expected for this session')
|
|
561
|
+
return values
|
|
562
|
+
|
|
550
563
|
model_config = ConfigDict(
|
|
551
564
|
json_schema_extra={
|
|
552
565
|
'example': {
|
|
@@ -554,6 +567,7 @@ class SessionRequest(BaseRequest):
|
|
|
554
567
|
'type': 'session.registration',
|
|
555
568
|
'success_url': 'http://example_success.com',
|
|
556
569
|
'failure_url': 'http://example_failure.com',
|
|
570
|
+
'resource_id': 'some_resource_id',
|
|
557
571
|
}
|
|
558
572
|
}
|
|
559
573
|
)
|
cuenca_validations/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = '2.1.
|
|
1
|
+
__version__ = '2.1.17.dev1'
|
{cuenca_validations-2.1.16.dev11.dist-info → cuenca_validations-2.1.17.dev1.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=e6JgUT88nxL_o_c-5LUY6R8NRuiknymB2XbxRAnmRj4,28
|
|
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=R8UklsHnxowJPPTuk3lFdglUcLDBVFQ_4By7bOU9Ul0,20421
|
|
11
11
|
cuenca_validations/types/files.py,sha256=2CszbwF9ytXV9suFFwyDjYG4XxY8UhCjRw3HttVXXNw,269
|
|
12
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.
|
|
17
|
+
cuenca_validations/types/requests.py,sha256=--h_OYZIfFJlZEDLvHtKt_K2TL8MO4gkApUbKvUHn-M,22625
|
|
18
|
+
cuenca_validations-2.1.17.dev1.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
|
-
tests/test_requests.py,sha256=
|
|
23
|
+
tests/test_requests.py,sha256=p4hb-jMExFyflOPe8t3XI6AEEC-3R6mK8OKx9U9q2bM,2307
|
|
24
24
|
tests/test_statement.py,sha256=IOE0rRRBgBZSJv_FLaETEyn5NzzXKMNTqgjv99GX-68,1436
|
|
25
25
|
tests/test_types.py,sha256=tq9YNF44fenQUJ6Fm6B46rLQHHtcTvfDGvcnTJLgueU,20777
|
|
26
|
-
cuenca_validations-2.1.
|
|
27
|
-
cuenca_validations-2.1.
|
|
28
|
-
cuenca_validations-2.1.
|
|
29
|
-
cuenca_validations-2.1.
|
|
26
|
+
cuenca_validations-2.1.17.dev1.dist-info/METADATA,sha256=baAm0BfzXNk26Oqkbko4xQaxSsJh5Os23UhSTS7-QAE,1600
|
|
27
|
+
cuenca_validations-2.1.17.dev1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
28
|
+
cuenca_validations-2.1.17.dev1.dist-info/top_level.txt,sha256=4233xdOs2HtuT-GFRjcDcwK0IwdwvWdczOtk0fPB6Gw,25
|
|
29
|
+
cuenca_validations-2.1.17.dev1.dist-info/RECORD,,
|
tests/test_requests.py
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import pytest
|
|
2
2
|
from pydantic import ValidationError
|
|
3
3
|
|
|
4
|
-
from cuenca_validations.types.
|
|
4
|
+
from cuenca_validations.types.enums import SessionType
|
|
5
|
+
from cuenca_validations.types.requests import (
|
|
6
|
+
SessionRequest,
|
|
7
|
+
UserTOSAgreementRequest,
|
|
8
|
+
)
|
|
5
9
|
from cuenca_validations.typing import DictStrAny
|
|
6
10
|
|
|
7
11
|
|
|
@@ -29,3 +33,38 @@ def test_file_cuenca_url_invalid() -> None:
|
|
|
29
33
|
)
|
|
30
34
|
with pytest.raises(ValidationError):
|
|
31
35
|
UserTOSAgreementRequest(**request_data)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def test_session_request_without_metadata():
|
|
39
|
+
request_data = {
|
|
40
|
+
'user_id': 'USWqY5cvkISJOxHyEKjAKf8w',
|
|
41
|
+
'type': 'session.curp_validation',
|
|
42
|
+
}
|
|
43
|
+
request = SessionRequest(**request_data)
|
|
44
|
+
assert request.type == SessionType.curp_validation
|
|
45
|
+
assert request.user_id == 'USWqY5cvkISJOxHyEKjAKf8w'
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def test_session_request_with_resource_id():
|
|
49
|
+
request_data = {
|
|
50
|
+
'user_id': 'USWqY5cvkISJOxHyEKjAKf8w',
|
|
51
|
+
'type': 'session.metamap_verification',
|
|
52
|
+
'resource_id': 'some_verification_id',
|
|
53
|
+
}
|
|
54
|
+
request = SessionRequest(**request_data)
|
|
55
|
+
assert request.type == SessionType.metamap_verification
|
|
56
|
+
assert request.user_id == 'USWqY5cvkISJOxHyEKjAKf8w'
|
|
57
|
+
assert request.resource_id
|
|
58
|
+
assert request.resource_id == 'some_verification_id'
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def test_metamap_session_request_without_metadata():
|
|
62
|
+
request_data = {
|
|
63
|
+
'user_id': 'USWqY5cvkISJOxHyEKjAKf8w',
|
|
64
|
+
'type': 'session.metamap_verification',
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
with pytest.raises(ValidationError) as exception:
|
|
68
|
+
SessionRequest(**request_data)
|
|
69
|
+
|
|
70
|
+
assert 'Resource id expected for this session' in str(exception)
|
{cuenca_validations-2.1.16.dev11.dist-info → cuenca_validations-2.1.17.dev1.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|
{cuenca_validations-2.1.16.dev11.dist-info → cuenca_validations-2.1.17.dev1.dist-info}/top_level.txt
RENAMED
|
File without changes
|