-
Notifications
You must be signed in to change notification settings - Fork 14
UserLists version #343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
UserLists version #343
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6f58d0b
UserLists version
alexviquez dfa19dc
linter
alexviquez aaf62da
adding to __init__ all resources
alexviquez 1ea3169
verification status inside resource
alexviquez 41a7cc4
tested
alexviquez a0ef708
v cv
alexviquez dac198c
version
alexviquez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import datetime as dt | ||
| from typing import ClassVar, Optional, cast | ||
|
|
||
| from cuenca_validations.types import UserListsRequest, VerificationStatus | ||
| from cuenca_validations.types.identities import CurpField | ||
|
|
||
| from ..http import Session, session as global_session | ||
| from .base import Creatable, Retrievable | ||
|
|
||
|
|
||
| class UserListsValidation(Creatable, Retrievable): | ||
| _resource: ClassVar = 'user_lists_validations' | ||
| created_at: dt.datetime | ||
| names: Optional[str] = None | ||
| first_surname: Optional[str] = None | ||
| second_surname: Optional[str] = None | ||
| curp: Optional[CurpField] = None | ||
| account_number: Optional[str] = None | ||
| status: Optional[VerificationStatus] = None | ||
|
|
||
| @classmethod | ||
| def create( | ||
| cls, | ||
| names: Optional[str] = None, | ||
| first_surname: Optional[str] = None, | ||
| second_surname: Optional[str] = None, | ||
| curp: Optional[CurpField] = None, | ||
| account_number: Optional[str] = None, | ||
| *, | ||
| session: Session = global_session, | ||
| ) -> 'UserListsValidation': | ||
| req = UserListsRequest( | ||
| names=names, | ||
| first_surname=first_surname, | ||
| second_surname=second_surname, | ||
| curp=curp, | ||
| account_number=account_number, | ||
| ) | ||
| return cast( | ||
| 'UserListsValidation', | ||
| cls._create(session=session, **req.dict()), | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| __version__ = '0.15.6' | ||
| __version__ = '0.15.7' | ||
| CLIENT_VERSION = __version__ | ||
| API_VERSION = '2020-03-19' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| requests==2.27.1 | ||
| cuenca-validations==0.11.15 | ||
| cuenca-validations==0.11.17 | ||
| dataclasses>=0.7;python_version<"3.7" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
tests/resources/cassettes/test_create_user_validation.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| interactions: | ||
| - request: | ||
| body: '{"curp": "LOHJ660606HDFPRS02", "account_number": null, "names": "Alejandro", | ||
| "first_surname": "Martinez", "second_surname": "Viquez"}' | ||
| headers: | ||
| Accept: | ||
| - '*/*' | ||
| Accept-Encoding: | ||
| - gzip, deflate | ||
| Authorization: | ||
| - DUMMY | ||
| Connection: | ||
| - keep-alive | ||
| Content-Length: | ||
| - '133' | ||
| Content-Type: | ||
| - application/json | ||
| User-Agent: | ||
| - cuenca-python/0.15.8.dev2 | ||
| X-Cuenca-Api-Version: | ||
| - '2020-03-19' | ||
| method: POST | ||
| uri: https://sandbox.cuenca.com/user_lists_validations | ||
| response: | ||
| body: | ||
| string: '{"id":"UVEb7dxQ9URaSPJ8T5AZx18w","created_at":"2023-01-26T22:31:43.776743","platform_id":"PTZbBlk__kQt-wfwzP5nwA9A","names":"Alejandro","first_surname":"Martinez","second_surname":"Viquez","curp":null,"status":"succeeded","error":null}' | ||
| headers: | ||
| Connection: | ||
| - keep-alive | ||
| Content-Length: | ||
| - '235' | ||
| Content-Type: | ||
| - application/json | ||
| Date: | ||
| - Thu, 26 Jan 2023 22:31:49 GMT | ||
| X-Request-Time: | ||
| - 'value: 5.414' | ||
| x-amz-apigw-id: | ||
| - fXzUdE5-CYcFjcQ= | ||
| x-amzn-Remapped-Connection: | ||
| - keep-alive | ||
| x-amzn-Remapped-Content-Length: | ||
| - '235' | ||
| x-amzn-Remapped-Date: | ||
| - Thu, 26 Jan 2023 22:31:49 GMT | ||
| x-amzn-Remapped-Server: | ||
| - nginx/1.22.1 | ||
| x-amzn-RequestId: | ||
| - d6df16fc-7de4-491c-8355-750fea51aa84 | ||
| status: | ||
| code: 201 | ||
| message: Created | ||
| version: 1 |
51 changes: 51 additions & 0 deletions
51
tests/resources/cassettes/test_create_user_validation_invalid_inputs.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| interactions: | ||
| - request: | ||
| body: '{"curp": null, "account_number": null, "names": null, "first_surname": | ||
| null, "second_surname": null}' | ||
| headers: | ||
| Accept: | ||
| - '*/*' | ||
| Accept-Encoding: | ||
| - gzip, deflate | ||
| Authorization: | ||
| - DUMMY | ||
| Connection: | ||
| - keep-alive | ||
| Content-Length: | ||
| - '100' | ||
| Content-Type: | ||
| - application/json | ||
| User-Agent: | ||
| - cuenca-python/0.15.8.dev2 | ||
| X-Cuenca-Api-Version: | ||
| - '2020-03-19' | ||
| method: POST | ||
| uri: https://sandbox.cuenca.com/user_lists_validations | ||
| response: | ||
| body: | ||
| string: '{"error":"There is an error with the inputs"}' | ||
| headers: | ||
| Connection: | ||
| - keep-alive | ||
| Content-Length: | ||
| - '45' | ||
| Content-Type: | ||
| - application/json | ||
| Date: | ||
| - Thu, 26 Jan 2023 22:34:19 GMT | ||
| x-amz-apigw-id: | ||
| - fXzszEKAiYcFpjA= | ||
| x-amzn-Remapped-Connection: | ||
| - keep-alive | ||
| x-amzn-Remapped-Content-Length: | ||
| - '45' | ||
| x-amzn-Remapped-Date: | ||
| - Thu, 26 Jan 2023 22:34:19 GMT | ||
| x-amzn-Remapped-Server: | ||
| - nginx/1.22.1 | ||
| x-amzn-RequestId: | ||
| - 7c91e271-c8ab-4fd7-a2c9-b7ab66f48daf | ||
| status: | ||
| code: 400 | ||
| message: Bad Request | ||
| version: 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import pytest | ||
| from cuenca_validations.types import VerificationStatus | ||
|
|
||
| from cuenca.exc import CuencaResponseException | ||
| from cuenca.resources import UserListsValidation | ||
|
|
||
|
|
||
| @pytest.mark.vcr | ||
| def test_create_user_validation(user_lists_request): | ||
| user_validation = UserListsValidation.create(**user_lists_request) | ||
| assert user_validation.status == VerificationStatus.succeeded | ||
| assert user_validation.id | ||
|
|
||
|
|
||
| @pytest.mark.vcr | ||
| def test_create_user_validation_invalid_inputs(): | ||
| with pytest.raises(CuencaResponseException) as exc: | ||
| UserListsValidation.create(**dict()) | ||
| assert exc.status_code == 403 | ||
| assert exc.json['error'] == 'There is an error with the inputs' |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Esta prueba está hecha con un curp que no existe, esto no afecta en nada?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No afecta, si no existe validamos con nombres