Skip to content

Commit 6f06ddc

Browse files
authored
Making user queryable by identity_id (#272)
* add tests * bump version * add test * fix cassette * finish tests * cv version * version for pre-release * bump * bump versions * alex anxiety
1 parent 1304600 commit 6f06ddc

File tree

5 files changed

+121
-2
lines changed

5 files changed

+121
-2
lines changed

cuenca/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
__version__ = '0.10.0'
1+
__version__ = '0.10.1'
22
CLIENT_VERSION = __version__
33
API_VERSION = '2020-03-19'

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
requests==2.27.1
2-
cuenca-validations==0.10.7
2+
cuenca-validations==0.10.9
33
dataclasses>=0.7;python_version<"3.7"
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
interactions:
2+
- request:
3+
body: null
4+
headers:
5+
Accept:
6+
- '*/*'
7+
Accept-Encoding:
8+
- gzip, deflate
9+
Authorization:
10+
- DUMMY
11+
Connection:
12+
- keep-alive
13+
User-Agent:
14+
- cuenca-python/0.10.1
15+
X-Cuenca-Api-Version:
16+
- '2020-03-19'
17+
method: GET
18+
uri: https://sandbox.cuenca.com/users?identity_uri=IDzqdGEBX_SMScteGcRDNtOg
19+
response:
20+
body:
21+
string: '{"items":[{"id":"US48qRpnZOQuKoAF1j_mnZ7Q","created_at":"2022-05-05T18:35:14.597000","updated_at":"2022-05-19T23:40:30.372000","identity_uri":"/identities/IDzqdGEBX_SMScteGcRDNtOg","level":2,"phone_number":"+525566556655","email_address":"alan@cuenca.com","profession":"employee","terms_of_service":{"version":"2022-01-01","ip":"201.141.24.14","location":null},"status":"active","address":{"street":null,"ext_number":null,"postal_code":null,"state":null,"country":null,"city":null,"int_number":null,"full_name":"RTNO
22+
1"},"govt_id":{"type":"ine","is_mx":true,"uri_front":"cuenca.com","uri_back":"cuenca.com","data":{}},"proof_of_address":null,"proof_of_life":null,"beneficiaries":null,"platform_id":"PTSFitwBYWROu-dAziDnSr4Q"},{"id":"USH19aFDPCTbetWNiltoqPyA","created_at":"2022-04-29T01:54:49.537000","updated_at":"2022-05-04T23:11:33.845000","identity_uri":"/identities/IDzqdGEBX_SMScteGcRDNtOg","level":3,"phone_number":"+525566778899","email_address":"yisus@cuenca.com","profession":null,"terms_of_service":{"version":"2022-01-01","ip":"10.0.23.99","location":null},"status":"active","address":null,"govt_id":{"type":"ine","is_mx":true,"uri_front":"cuenca.com","uri_back":"cuenca.com","data":{}},"proof_of_address":{"type":"proof_of_address","is_mx":true,"uri_front":"cuenca.com","uri_back":null,"data":{}},"proof_of_life":null,"beneficiaries":null,"platform_id":"PTW68GgAc_QPmNCmgajmctLg"}],"next_page_uri":null,"count":null,"fields":{"items":{"description":"List
23+
of Users that match with query filters"},"next_page_uri":{"description":"URL
24+
to fetch the next page of results"},"count":{"description":"Counter of Users
25+
objects that match with query filters. \nIncluded in response only if `count`
26+
param was `true`"}}}'
27+
headers:
28+
Connection:
29+
- keep-alive
30+
Content-Length:
31+
- '2006'
32+
Content-Type:
33+
- application/json
34+
Date:
35+
- Fri, 10 Jun 2022 01:24:50 GMT
36+
x-amz-apigw-id:
37+
- Te2HaHFyCYcFpfQ=
38+
x-amzn-Remapped-Connection:
39+
- keep-alive
40+
x-amzn-Remapped-Content-Length:
41+
- '2006'
42+
x-amzn-Remapped-Date:
43+
- Fri, 10 Jun 2022 01:24:50 GMT
44+
x-amzn-Remapped-Server:
45+
- nginx/1.22.0
46+
x-amzn-RequestId:
47+
- 9977aaa0-5fee-4616-bd99-f105a2246da6
48+
status:
49+
code: 200
50+
message: OK
51+
version: 1
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
interactions:
2+
- request:
3+
body: null
4+
headers:
5+
Accept:
6+
- '*/*'
7+
Accept-Encoding:
8+
- gzip, deflate
9+
Authorization:
10+
- DUMMY
11+
Connection:
12+
- keep-alive
13+
User-Agent:
14+
- cuenca-python/0.10.0
15+
X-Cuenca-Api-Version:
16+
- '2020-03-19'
17+
method: GET
18+
uri: https://sandbox.cuenca.com/users?limit=1&identity_uri=IDzqdGEBX_SMScteGcRDNtOg
19+
response:
20+
body:
21+
string: '{"items":[{"id":"US1234","created_at":"2022-05-05T18:35:14.597000","updated_at":"2022-05-19T23:40:30.372000","identity_uri":"/identities/IDzqdGEBX_SMScteGcRDNtOg","level":2,"phone_number":"+525512345678","email_address":"alan@cuenca.com","profession":"employee","terms_of_service":{"version":"2022-01-01","ip":"201.141.24.14","location":null},"status":"active","address":{"street":null,"ext_number":null,"postal_code":null,"state":null,"country":null,"city":null,"int_number":null,"full_name":"RTNO
22+
1"},"govt_id":{"type":"ine","is_mx":true,"uri_front": "cuenca.com", "uri_back":
23+
"cuenca.com","data":{}},"proof_of_address":null,"proof_of_life":null,"beneficiaries":null,"platform_id":"PT12334"}],"next_page_uri":null,"count":null,"fields":{"items":{"description":"List
24+
of Users that match with query filters"},"next_page_uri":{"description":"URL
25+
to fetch the next page of results"},"count":{"description":"Counter of Users
26+
objects that match with query filters. \nIncluded in response only if `count`
27+
param was `true`"}}}'
28+
headers:
29+
Connection:
30+
- keep-alive
31+
Content-Length:
32+
- '1202'
33+
Content-Type:
34+
- application/json
35+
Date:
36+
- Mon, 06 Jun 2022 22:40:27 GMT
37+
x-amz-apigw-id:
38+
- TUlONEZzCYcFWcg=
39+
x-amzn-Remapped-Connection:
40+
- keep-alive
41+
x-amzn-Remapped-Content-Length:
42+
- '1202'
43+
x-amzn-Remapped-Date:
44+
- Mon, 06 Jun 2022 22:40:26 GMT
45+
x-amzn-Remapped-Server:
46+
- nginx/1.22.0
47+
x-amzn-RequestId:
48+
- 7fd67e4a-66bb-4746-9ad9-55ac5637ce95
49+
status:
50+
code: 200
51+
message: OK
52+
version: 1

tests/resources/test_users.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,19 @@ def test_user_identity_retrieve():
4444
assert user_id == user.id
4545
identity = user.identity
4646
assert identity.id is not None
47+
48+
49+
@pytest.mark.vcr
50+
def test_user_query_by_identity_id():
51+
identity_id = 'IDzqdGEBX_SMScteGcRDNtOg'
52+
user = User.first(identity_uri=identity_id)
53+
assert identity_id in user.identity_uri
54+
55+
56+
@pytest.mark.vcr
57+
def test_user_query_all_identity_id():
58+
identity_id = 'IDzqdGEBX_SMScteGcRDNtOg'
59+
users = [user for user in User.all(identity_uri=identity_id)]
60+
assert len(users) == 2
61+
assert users[0].id != users[1].id
62+
assert users[0].identity_uri == users[1].identity_uri

0 commit comments

Comments
 (0)