cuenca-validations 2.0.0.dev7__tar.gz → 2.0.0.dev9__tar.gz
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-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/PKG-INFO +11 -8
- {cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/cuenca_validations/types/card.py +5 -1
- {cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/cuenca_validations/types/files.py +2 -2
- {cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/cuenca_validations/types/general.py +2 -24
- {cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/cuenca_validations/types/morals.py +0 -2
- {cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/cuenca_validations/types/queries.py +10 -31
- {cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/cuenca_validations/types/requests.py +15 -16
- cuenca_validations-2.0.0.dev9/cuenca_validations/version.py +1 -0
- {cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/cuenca_validations.egg-info/PKG-INFO +11 -8
- cuenca_validations-2.0.0.dev9/cuenca_validations.egg-info/requires.txt +4 -0
- {cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/setup.py +10 -7
- {cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/tests/test_card.py +5 -1
- {cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/tests/test_errors.py +0 -25
- {cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/tests/test_types.py +9 -14
- cuenca_validations-2.0.0.dev7/cuenca_validations/version.py +0 -1
- cuenca_validations-2.0.0.dev7/cuenca_validations.egg-info/requires.txt +0 -7
- {cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/LICENSE +0 -0
- {cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/README.md +0 -0
- {cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/cuenca_validations/__init__.py +0 -0
- {cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/cuenca_validations/card_bins.py +0 -0
- {cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/cuenca_validations/errors.py +0 -0
- {cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/cuenca_validations/py.typed +0 -0
- {cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/cuenca_validations/types/__init__.py +0 -0
- {cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/cuenca_validations/types/enums.py +0 -0
- {cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/cuenca_validations/types/identities.py +0 -0
- {cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/cuenca_validations/typing.py +0 -0
- {cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/cuenca_validations/validators.py +0 -0
- {cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/cuenca_validations.egg-info/SOURCES.txt +0 -0
- {cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/cuenca_validations.egg-info/dependency_links.txt +0 -0
- {cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/cuenca_validations.egg-info/top_level.txt +0 -0
- {cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/setup.cfg +0 -0
- {cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/tests/__init__.py +0 -0
- {cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/tests/test_statement.py +0 -0
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: cuenca_validations
|
|
3
|
-
Version: 2.0.0.
|
|
3
|
+
Version: 2.0.0.dev9
|
|
4
4
|
Summary: Cuenca common validations
|
|
5
5
|
Home-page: https://github.com/cuenca-mx/cuenca-validations
|
|
6
6
|
Author: Cuenca
|
|
7
7
|
Author-email: dev@cuenca.com
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: Programming Language :: Python :: 3.
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
10
14
|
Classifier: License :: OSI Approved :: MIT License
|
|
11
15
|
Classifier: Operating System :: OS Independent
|
|
12
|
-
Requires-Python: >=3.
|
|
16
|
+
Requires-Python: >=3.9
|
|
13
17
|
Description-Content-Type: text/markdown
|
|
14
18
|
License-File: LICENSE
|
|
15
|
-
Requires-Dist: clabe>=2.0.0
|
|
16
|
-
Requires-Dist: pydantic[email]>=2.0
|
|
17
|
-
Requires-Dist: pydantic-extra-types
|
|
18
|
-
Requires-Dist:
|
|
19
|
-
Requires-Dist: python-dateutil>=2.7.0
|
|
19
|
+
Requires-Dist: clabe>=2.0.0
|
|
20
|
+
Requires-Dist: pydantic[email]>=2.10.0
|
|
21
|
+
Requires-Dist: pydantic-extra-types>=2.10.0
|
|
22
|
+
Requires-Dist: python-dateutil>=2.8.0
|
|
20
23
|
|
|
21
24
|
# Cuenca - validations
|
|
22
25
|
|
{cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/cuenca_validations/types/card.py
RENAMED
|
@@ -13,7 +13,11 @@ class StrictPaymentCardNumber(BaseModel):
|
|
|
13
13
|
def validate_bin(cls, card_number: PaymentCardNumber) -> PaymentCardNumber:
|
|
14
14
|
if card_number.bin not in CARD_BINS:
|
|
15
15
|
raise PydanticCustomError(
|
|
16
|
-
'payment_card_number.bin',
|
|
16
|
+
'payment_card_number.bin',
|
|
17
|
+
'The card number contains a BIN (first six digits) '
|
|
18
|
+
'that does not have a known association with a Mexican bank.'
|
|
19
|
+
'To add the association, please file an issue:'
|
|
20
|
+
'https://github.com/cuenca-mx/cuenca-validations/issues',
|
|
17
21
|
)
|
|
18
22
|
return card_number
|
|
19
23
|
|
{cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/cuenca_validations/types/files.py
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from typing import Optional
|
|
2
2
|
|
|
3
|
-
from pydantic import
|
|
3
|
+
from pydantic import BaseModel, HttpUrl
|
|
4
4
|
|
|
5
5
|
from .enums import KYCFileType
|
|
6
6
|
|
|
@@ -9,4 +9,4 @@ class BatchFileMetadata(BaseModel):
|
|
|
9
9
|
id: Optional[str] = None
|
|
10
10
|
is_back: bool
|
|
11
11
|
type: KYCFileType
|
|
12
|
-
url:
|
|
12
|
+
url: HttpUrl
|
{cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/cuenca_validations/types/general.py
RENAMED
|
@@ -19,32 +19,10 @@ class JSONEncoder(json.JSONEncoder):
|
|
|
19
19
|
return sanitize_item(o, default=super().default)
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
if not isinstance(value, int):
|
|
24
|
-
raise ValueError("Value must be an integer")
|
|
25
|
-
if value <= 0:
|
|
26
|
-
raise ValueError("Value must be greater than 0")
|
|
27
|
-
if value > 21_474_836_47:
|
|
28
|
-
raise ValueError("Value must be less than 21_474_836_47")
|
|
29
|
-
return value
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
StrictPositiveInt = Annotated[
|
|
33
|
-
int, BeforeValidator(validate_strict_positive_int)
|
|
34
|
-
]
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
def validate_strict_positive_float(value: float) -> float:
|
|
38
|
-
if not isinstance(value, float):
|
|
39
|
-
raise ValueError("Value must be a float")
|
|
40
|
-
if value <= 0:
|
|
41
|
-
raise ValueError("Value must be greater than 0")
|
|
42
|
-
return value
|
|
22
|
+
StrictPositiveInt = Annotated[int, Field(strict=True, gt=0, le=21_474_836_47)]
|
|
43
23
|
|
|
44
24
|
|
|
45
|
-
StrictPositiveFloat = Annotated[
|
|
46
|
-
float, BeforeValidator(validate_strict_positive_float)
|
|
47
|
-
]
|
|
25
|
+
StrictPositiveFloat = Annotated[float, Field(strict=True, gt=0)]
|
|
48
26
|
|
|
49
27
|
|
|
50
28
|
def validate_only_digits(value: str) -> str:
|
{cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/cuenca_validations/types/queries.py
RENAMED
|
@@ -5,10 +5,11 @@ from pydantic import (
|
|
|
5
5
|
BaseModel,
|
|
6
6
|
ConfigDict,
|
|
7
7
|
EmailStr,
|
|
8
|
+
Field,
|
|
8
9
|
PositiveInt,
|
|
9
|
-
conint,
|
|
10
10
|
field_validator,
|
|
11
11
|
)
|
|
12
|
+
from typing_extensions import Annotated
|
|
12
13
|
|
|
13
14
|
from ..typing import DictStrAny
|
|
14
15
|
from ..validators import sanitize_dict
|
|
@@ -31,9 +32,9 @@ MAX_PAGE_SIZE = 100
|
|
|
31
32
|
|
|
32
33
|
class QueryParams(BaseModel):
|
|
33
34
|
count: bool = False
|
|
34
|
-
page_size:
|
|
35
|
-
gt=0, le=MAX_PAGE_SIZE
|
|
36
|
-
|
|
35
|
+
page_size: Annotated[
|
|
36
|
+
int, Field(gt=0, le=MAX_PAGE_SIZE, default=MAX_PAGE_SIZE)
|
|
37
|
+
]
|
|
37
38
|
limit: Optional[PositiveInt] = None
|
|
38
39
|
user_id: Optional[str] = None
|
|
39
40
|
created_before: Optional[dt.datetime] = None
|
|
@@ -105,21 +106,6 @@ class ApiKeyQuery(QueryParams):
|
|
|
105
106
|
'description': 'Set `true` value to fetch active keys or '
|
|
106
107
|
'`false` to fetch deactivated keys'
|
|
107
108
|
},
|
|
108
|
-
'count': {
|
|
109
|
-
'description': 'Set `true` value to get only a counter'
|
|
110
|
-
},
|
|
111
|
-
'page_size': {'description': 'Number of items per page'},
|
|
112
|
-
'limit': {'description': 'Limit of items to query'},
|
|
113
|
-
'created_before': {
|
|
114
|
-
'description': 'Filtered items have a `created_at` '
|
|
115
|
-
'date equal or lower than this value, this field '
|
|
116
|
-
'represents the max creation date.'
|
|
117
|
-
},
|
|
118
|
-
'created_after': {
|
|
119
|
-
'description': 'Filtered items have a `created_at` '
|
|
120
|
-
'date equal or greater than this value, this field '
|
|
121
|
-
'represents the min creation date.'
|
|
122
|
-
},
|
|
123
109
|
}
|
|
124
110
|
},
|
|
125
111
|
)
|
|
@@ -139,14 +125,9 @@ class CardQuery(QueryParams):
|
|
|
139
125
|
type: Optional[CardType] = None
|
|
140
126
|
|
|
141
127
|
@field_validator('exp_month', 'exp_year', 'cvv2', 'cvv')
|
|
142
|
-
def query_by_exp_cvv_if_number_set(cls, v,
|
|
143
|
-
if not
|
|
144
|
-
raise ValueError(
|
|
145
|
-
'''
|
|
146
|
-
exp_month, exp_year, cvv and cvv2 can
|
|
147
|
-
only be set when number is provided
|
|
148
|
-
'''
|
|
149
|
-
)
|
|
128
|
+
def query_by_exp_cvv_if_number_set(cls, v, values):
|
|
129
|
+
if not values.data.get('number'):
|
|
130
|
+
raise ValueError('Number must be set to query by exp or cvv')
|
|
150
131
|
return v
|
|
151
132
|
|
|
152
133
|
|
|
@@ -155,8 +136,8 @@ class StatementQuery(QueryParams):
|
|
|
155
136
|
month: int
|
|
156
137
|
|
|
157
138
|
@field_validator('month')
|
|
158
|
-
def validate_year_month(cls, month,
|
|
159
|
-
year =
|
|
139
|
+
def validate_year_month(cls, month, values):
|
|
140
|
+
year = values.data['year']
|
|
160
141
|
month_now = dt.date.today().replace(day=1)
|
|
161
142
|
month_set = dt.date(year, month, 1)
|
|
162
143
|
if month_set >= month_now:
|
|
@@ -190,8 +171,6 @@ class UserQuery(QueryParams):
|
|
|
190
171
|
|
|
191
172
|
|
|
192
173
|
class IdentityQuery(QueryParams):
|
|
193
|
-
model_config = dict(arbitrary_types_allowed=True)
|
|
194
|
-
|
|
195
174
|
curp: Optional[CurpField] = None
|
|
196
175
|
rfc: Optional[str] = None
|
|
197
176
|
status: Optional[UserStatus] = None
|
{cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/cuenca_validations/types/requests.py
RENAMED
|
@@ -112,8 +112,8 @@ class TransferRequest(BaseRequest):
|
|
|
112
112
|
)
|
|
113
113
|
|
|
114
114
|
|
|
115
|
-
class StrictTransferRequest(
|
|
116
|
-
account_number: Union[Clabe, StrictPaymentCardNumber]
|
|
115
|
+
class StrictTransferRequest(TransferRequest):
|
|
116
|
+
account_number: Union[Clabe, StrictPaymentCardNumber] # type: ignore
|
|
117
117
|
|
|
118
118
|
|
|
119
119
|
class CardUpdateRequest(BaseRequest):
|
|
@@ -140,8 +140,8 @@ class CardActivationRequest(BaseModel):
|
|
|
140
140
|
pattern=r'\d{16}',
|
|
141
141
|
),
|
|
142
142
|
]
|
|
143
|
-
exp_month: Annotated[int, Field(strict=True, ge=1, le=12)]
|
|
144
|
-
exp_year: Annotated[int, Field(strict=True, ge=18, le=99)]
|
|
143
|
+
exp_month: Annotated[int, Field(strict=True, ge=1, le=12)]
|
|
144
|
+
exp_year: Annotated[int, Field(strict=True, ge=18, le=99)]
|
|
145
145
|
cvv2: Annotated[
|
|
146
146
|
str,
|
|
147
147
|
StringConstraints(
|
|
@@ -207,7 +207,7 @@ class CardValidationRequest(BaseModel):
|
|
|
207
207
|
]
|
|
208
208
|
exp_month: Optional[Annotated[int, Field(strict=True, ge=1, le=12)]] = None
|
|
209
209
|
exp_year: Optional[Annotated[int, Field(strict=True, ge=18, le=99)]] = None
|
|
210
|
-
cvv: Optional[
|
|
210
|
+
cvv: Optional[
|
|
211
211
|
Annotated[
|
|
212
212
|
str,
|
|
213
213
|
StringConstraints(
|
|
@@ -215,7 +215,7 @@ class CardValidationRequest(BaseModel):
|
|
|
215
215
|
),
|
|
216
216
|
]
|
|
217
217
|
] = None
|
|
218
|
-
cvv2: Optional[
|
|
218
|
+
cvv2: Optional[
|
|
219
219
|
Annotated[
|
|
220
220
|
str,
|
|
221
221
|
StringConstraints(
|
|
@@ -223,7 +223,7 @@ class CardValidationRequest(BaseModel):
|
|
|
223
223
|
),
|
|
224
224
|
]
|
|
225
225
|
] = None
|
|
226
|
-
icvv: Optional[
|
|
226
|
+
icvv: Optional[
|
|
227
227
|
Annotated[
|
|
228
228
|
str,
|
|
229
229
|
StringConstraints(
|
|
@@ -272,7 +272,7 @@ class CardTransactionRequest(BaseModel):
|
|
|
272
272
|
card_id: str
|
|
273
273
|
user_id: str
|
|
274
274
|
# In some card_validations amount is equal to 0
|
|
275
|
-
amount: Annotated[int, Field(strict=True, ge=0)]
|
|
275
|
+
amount: Annotated[int, Field(strict=True, ge=0)]
|
|
276
276
|
merchant_name: str
|
|
277
277
|
merchant_type: str
|
|
278
278
|
merchant_data: str
|
|
@@ -285,8 +285,7 @@ class CardTransactionRequest(BaseModel):
|
|
|
285
285
|
authorizer_number: Optional[str] = None
|
|
286
286
|
|
|
287
287
|
|
|
288
|
-
class ReverseRequest(CardTransactionRequest):
|
|
289
|
-
...
|
|
288
|
+
class ReverseRequest(CardTransactionRequest): ... # noqa: E701
|
|
290
289
|
|
|
291
290
|
|
|
292
291
|
class CardNotificationRequest(CardTransactionRequest):
|
|
@@ -300,9 +299,9 @@ class ChargeRequest(CardNotificationRequest):
|
|
|
300
299
|
get_balance: Optional[bool] = False
|
|
301
300
|
atm_fee: Optional[StrictPositiveInt] = None
|
|
302
301
|
issuer: IssuerNetwork
|
|
303
|
-
cardholder_verification_method: Optional[
|
|
304
|
-
|
|
305
|
-
|
|
302
|
+
cardholder_verification_method: Optional[CardholderVerificationMethod] = (
|
|
303
|
+
None
|
|
304
|
+
)
|
|
306
305
|
ecommerce_indicator: Optional[EcommerceIndicator] = None
|
|
307
306
|
fraud_validation_id: Optional[str] = None
|
|
308
307
|
|
|
@@ -353,9 +352,9 @@ class FraudValidationRequest(BaseModel):
|
|
|
353
352
|
logical_network: Optional[str] = None
|
|
354
353
|
is_cvv: Optional[bool] = False
|
|
355
354
|
issuer: IssuerNetwork
|
|
356
|
-
cardholder_verification_method: Optional[
|
|
357
|
-
|
|
358
|
-
|
|
355
|
+
cardholder_verification_method: Optional[CardholderVerificationMethod] = (
|
|
356
|
+
None
|
|
357
|
+
)
|
|
359
358
|
ecommerce_indicator: Optional[EcommerceIndicator] = None
|
|
360
359
|
card_id: Optional[str] = None # type: ignore
|
|
361
360
|
user_id: Optional[str] = None # type: ignore
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '2.0.0.dev9'
|
{cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/cuenca_validations.egg-info/PKG-INFO
RENAMED
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: cuenca_validations
|
|
3
|
-
Version: 2.0.0.
|
|
3
|
+
Version: 2.0.0.dev9
|
|
4
4
|
Summary: Cuenca common validations
|
|
5
5
|
Home-page: https://github.com/cuenca-mx/cuenca-validations
|
|
6
6
|
Author: Cuenca
|
|
7
7
|
Author-email: dev@cuenca.com
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: Programming Language :: Python :: 3.
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
10
14
|
Classifier: License :: OSI Approved :: MIT License
|
|
11
15
|
Classifier: Operating System :: OS Independent
|
|
12
|
-
Requires-Python: >=3.
|
|
16
|
+
Requires-Python: >=3.9
|
|
13
17
|
Description-Content-Type: text/markdown
|
|
14
18
|
License-File: LICENSE
|
|
15
|
-
Requires-Dist: clabe>=2.0.0
|
|
16
|
-
Requires-Dist: pydantic[email]>=2.0
|
|
17
|
-
Requires-Dist: pydantic-extra-types
|
|
18
|
-
Requires-Dist:
|
|
19
|
-
Requires-Dist: python-dateutil>=2.7.0
|
|
19
|
+
Requires-Dist: clabe>=2.0.0
|
|
20
|
+
Requires-Dist: pydantic[email]>=2.10.0
|
|
21
|
+
Requires-Dist: pydantic-extra-types>=2.10.0
|
|
22
|
+
Requires-Dist: python-dateutil>=2.8.0
|
|
20
23
|
|
|
21
24
|
# Cuenca - validations
|
|
22
25
|
|
|
@@ -23,17 +23,20 @@ setup(
|
|
|
23
23
|
packages=find_packages(),
|
|
24
24
|
include_package_data=True,
|
|
25
25
|
package_data=dict(cuenca_validations=['py.typed']),
|
|
26
|
-
python_requires='>=3.
|
|
26
|
+
python_requires='>=3.9',
|
|
27
27
|
install_requires=[
|
|
28
|
-
'clabe>=2.0.0
|
|
29
|
-
'pydantic[email]>=2.0',
|
|
30
|
-
'pydantic-extra-types
|
|
31
|
-
'
|
|
32
|
-
'python-dateutil>=2.7.0',
|
|
28
|
+
'clabe>=2.0.0',
|
|
29
|
+
'pydantic[email]>=2.10.0',
|
|
30
|
+
'pydantic-extra-types>=2.10.0',
|
|
31
|
+
'python-dateutil>=2.8.0',
|
|
33
32
|
],
|
|
34
33
|
classifiers=[
|
|
35
34
|
'Programming Language :: Python :: 3',
|
|
36
|
-
'Programming Language :: Python :: 3.
|
|
35
|
+
'Programming Language :: Python :: 3.9',
|
|
36
|
+
'Programming Language :: Python :: 3.10',
|
|
37
|
+
'Programming Language :: Python :: 3.11',
|
|
38
|
+
'Programming Language :: Python :: 3.12',
|
|
39
|
+
'Programming Language :: Python :: 3.13',
|
|
37
40
|
'License :: OSI Approved :: MIT License',
|
|
38
41
|
'Operating System :: OS Independent',
|
|
39
42
|
],
|
|
@@ -11,7 +11,11 @@ INVALID_BIN = '4050000000000001'
|
|
|
11
11
|
def test_invalid_bin_strict_payment():
|
|
12
12
|
with pytest.raises(ValidationError) as exc_info:
|
|
13
13
|
StrictPaymentCardNumber(card_number=INVALID_BIN)
|
|
14
|
-
|
|
14
|
+
print(exc_info.value)
|
|
15
|
+
assert 'payment_card_number.bin' in str(exc_info.value)
|
|
16
|
+
assert 'The card number contains a BIN (first six digits) ' in str(
|
|
17
|
+
exc_info.value
|
|
18
|
+
)
|
|
15
19
|
|
|
16
20
|
|
|
17
21
|
def test_valid_bin_strict_payment():
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import pytest
|
|
2
|
-
|
|
3
1
|
from cuenca_validations.errors import (
|
|
4
|
-
ERROR_CODES,
|
|
5
2
|
ApiError,
|
|
6
3
|
AuthMethodNotAllowedError,
|
|
7
4
|
CuencaError,
|
|
@@ -35,25 +32,3 @@ def test_error_codes_and_status():
|
|
|
35
32
|
for error_class, expected_code, expected_status in test_cases:
|
|
36
33
|
assert error_class.code == expected_code
|
|
37
34
|
assert error_class.status_code == expected_status
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
def test_error_messages():
|
|
41
|
-
test_message = "Mensaje de prueba"
|
|
42
|
-
|
|
43
|
-
for error_class in ERROR_CODES.values():
|
|
44
|
-
with pytest.raises(error_class) as exc_info:
|
|
45
|
-
raise error_class(test_message)
|
|
46
|
-
assert str(exc_info.value) == test_message
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
def test_error_codes_mapping():
|
|
50
|
-
for error_class in ERROR_CODES.values():
|
|
51
|
-
assert ERROR_CODES[error_class.code] == error_class
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
def test_api_error():
|
|
55
|
-
with pytest.raises(ApiError) as exc_info:
|
|
56
|
-
raise ApiError("Error interno")
|
|
57
|
-
assert str(exc_info.value) == "Error interno"
|
|
58
|
-
assert exc_info.value.code == 500
|
|
59
|
-
assert exc_info.value.status_code == 500
|
|
@@ -150,8 +150,7 @@ def test_invalid_class():
|
|
|
150
150
|
raises a `TypeError`.
|
|
151
151
|
"""
|
|
152
152
|
|
|
153
|
-
class ClassWithoutToDict:
|
|
154
|
-
...
|
|
153
|
+
class ClassWithoutToDict: ... # noqa: E701
|
|
155
154
|
|
|
156
155
|
invalid_class = ClassWithoutToDict()
|
|
157
156
|
with pytest.raises(TypeError):
|
|
@@ -551,7 +550,7 @@ def test_verification_attempt_request():
|
|
|
551
550
|
|
|
552
551
|
def test_limited_wallet_request():
|
|
553
552
|
curp = 'TAXM840916HNEMXT02'
|
|
554
|
-
rfc =
|
|
553
|
+
rfc = 'TAXM840916123'
|
|
555
554
|
# Not valid format
|
|
556
555
|
with pytest.raises(ValidationError):
|
|
557
556
|
LimitedWalletRequest(allowed_curp='123', allowed_rfc='123')
|
|
@@ -594,14 +593,10 @@ def test_strict_positive_float_valid():
|
|
|
594
593
|
|
|
595
594
|
|
|
596
595
|
def test_strict_positive_float_invalid():
|
|
597
|
-
with pytest.raises(ValueError, match="
|
|
596
|
+
with pytest.raises(ValueError, match="Input should be greater than 0"):
|
|
598
597
|
TestFloatModel(value=0.0)
|
|
599
|
-
with pytest.raises(ValueError, match="
|
|
598
|
+
with pytest.raises(ValueError, match="Input should be greater than 0"):
|
|
600
599
|
TestFloatModel(value=-1.5)
|
|
601
|
-
with pytest.raises(ValueError, match="Value must be a float"):
|
|
602
|
-
TestFloatModel(value=5)
|
|
603
|
-
with pytest.raises(ValueError, match="Value must be a float"):
|
|
604
|
-
TestFloatModel(value="10.5")
|
|
605
600
|
|
|
606
601
|
|
|
607
602
|
class TestIntModel(BaseModel):
|
|
@@ -620,19 +615,19 @@ def test_strict_positive_int_valid():
|
|
|
620
615
|
|
|
621
616
|
|
|
622
617
|
def test_strict_positive_int_invalid():
|
|
623
|
-
with pytest.raises(ValueError, match="
|
|
618
|
+
with pytest.raises(ValueError, match="Input should be greater than 0"):
|
|
624
619
|
TestIntModel(value=0)
|
|
625
620
|
|
|
626
|
-
with pytest.raises(ValueError, match="
|
|
621
|
+
with pytest.raises(ValueError, match="Input should be greater than 0"):
|
|
627
622
|
TestIntModel(value=-5)
|
|
628
623
|
|
|
629
624
|
with pytest.raises(
|
|
630
|
-
ValueError, match="
|
|
625
|
+
ValueError, match="Input should be less than or equal to 2147483647"
|
|
631
626
|
):
|
|
632
627
|
TestIntModel(value=21_474_836_48)
|
|
633
628
|
|
|
634
|
-
with pytest.raises(ValueError, match="
|
|
629
|
+
with pytest.raises(ValueError, match="Input should be a valid integer"):
|
|
635
630
|
TestIntModel(value=5.5)
|
|
636
631
|
|
|
637
|
-
with pytest.raises(ValueError, match="
|
|
632
|
+
with pytest.raises(ValueError, match="Input should be a valid integer"):
|
|
638
633
|
TestIntModel(value="10")
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = '2.0.0.dev7'
|
|
File without changes
|
|
File without changes
|
{cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/cuenca_validations/__init__.py
RENAMED
|
File without changes
|
{cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/cuenca_validations/card_bins.py
RENAMED
|
File without changes
|
{cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/cuenca_validations/errors.py
RENAMED
|
File without changes
|
|
File without changes
|
{cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/cuenca_validations/types/__init__.py
RENAMED
|
File without changes
|
{cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/cuenca_validations/types/enums.py
RENAMED
|
File without changes
|
|
File without changes
|
{cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/cuenca_validations/typing.py
RENAMED
|
File without changes
|
{cuenca_validations-2.0.0.dev7 → cuenca_validations-2.0.0.dev9}/cuenca_validations/validators.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|