From 142f5a1aa908dc85bf405b48c5936a25e6374041 Mon Sep 17 00:00:00 2001 From: ryannguyen16 <98357619+ryannguyen16@users.noreply.github.com> Date: Fri, 8 Jul 2022 12:42:07 -0700 Subject: [PATCH] updated referral test --- tests/cassettes/test_referral_user_all.yaml | 54 +++++++++++---------- tests/test_referral.py | 7 ++- 2 files changed, 33 insertions(+), 28 deletions(-) diff --git a/tests/cassettes/test_referral_user_all.yaml b/tests/cassettes/test_referral_user_all.yaml index 89f10b6f..3bc56b65 100644 --- a/tests/cassettes/test_referral_user_all.yaml +++ b/tests/cassettes/test_referral_user_all.yaml @@ -9,55 +9,56 @@ interactions: Connection: - keep-alive authorization: - - REDACTED + - user-agent: - - REDACTED + - method: GET uri: https://api.easypost.com/beta/referral_customers?page_size=5 response: body: - string: '[{"id": "user_634b6daa05744bfaa205058f06864363", "object": "User", - "parent_id": null, "name": "Firstname Lastname", "phone_number": "REDACTED", - "verified": true, "created_at": "2022-04-26T15:50:28Z", "balance": "0.00000", - "price_per_shipment": "0.00000", "recharge_amount": null, "secondary_recharge_amount": + string: '{"has_more": true, "referral_customers": [{"id": "user_634b6daa05744bfaa205058f06864363", + "object": "User", "parent_id": null, "name": "Firstname Lastname", "phone_number": + "8888888888", "verified": true, "created_at": "2022-04-26T15:50:28Z", "balance": + "0.00000", "price_per_shipment": "0.00000", "recharge_amount": null, "secondary_recharge_amount": null, "recharge_threshold": null, "has_billing_method": null, "cc_fee_rate": "0.0325", "default_insurance_amount": "50.00", "insurance_fee_rate": "0.005", - "insurance_fee_minimum": "0.25", "email": "REDACTED", "children": ["REDACTED"]}, + "insurance_fee_minimum": "0.25", "email": "me2@email.com", "children": []}, {"id": "user_35cb81fb8af1454dabf1f6afa7330634", "object": "User", "parent_id": - null, "name": "Firstname Lastname", "phone_number": "REDACTED", "verified": + null, "name": "Firstname Lastname", "phone_number": "8888888888", "verified": true, "created_at": "2022-04-27T20:20:52Z", "balance": "0.00000", "price_per_shipment": "0.00000", "recharge_amount": "100.00", "secondary_recharge_amount": "100.00", "recharge_threshold": "0.00", "has_billing_method": true, "cc_fee_rate": "0.0325", "default_insurance_amount": "50.00", "insurance_fee_rate": "0.005", "insurance_fee_minimum": - "0.25", "email": "REDACTED", "children": ["REDACTED"]}, {"id": "user_fa93cc16bcc24c078ee057ce82f38eed", + "0.25", "email": "email@example.com", "children": []}, {"id": "user_fa93cc16bcc24c078ee057ce82f38eed", "object": "User", "parent_id": null, "name": "test test", "phone_number": - "REDACTED", "verified": true, "created_at": "2022-04-28T22:34:38Z", "balance": + "8888888888", "verified": true, "created_at": "2022-04-28T22:34:38Z", "balance": "0.00000", "price_per_shipment": "0.00000", "recharge_amount": null, "secondary_recharge_amount": null, "recharge_threshold": null, "has_billing_method": null, "cc_fee_rate": "0.0325", "default_insurance_amount": "50.00", "insurance_fee_rate": "0.005", - "insurance_fee_minimum": "0.25", "email": "REDACTED", "children": ["REDACTED"]}, - {"id": "user_4a22730cdc844ce1bc2efbed999c869f", "object": "User", "parent_id": - null, "name": "test test", "phone_number": "REDACTED", "verified": true, "created_at": - "2022-04-29T19:35:33Z", "balance": "0.00000", "price_per_shipment": "0.00000", - "recharge_amount": null, "secondary_recharge_amount": null, "recharge_threshold": + "insurance_fee_minimum": "0.25", "email": "email@example.com", "children": + []}, {"id": "user_4a22730cdc844ce1bc2efbed999c869f", "object": "User", "parent_id": + null, "name": "test test", "phone_number": "8888888888", "verified": true, + "created_at": "2022-04-29T19:35:33Z", "balance": "0.00000", "price_per_shipment": + "0.00000", "recharge_amount": null, "secondary_recharge_amount": null, "recharge_threshold": null, "has_billing_method": null, "cc_fee_rate": "0.0325", "default_insurance_amount": "50.00", "insurance_fee_rate": "0.005", "insurance_fee_minimum": "0.25", "email": - "REDACTED", "children": ["REDACTED"]}, {"id": "user_488e391395f4416196a31965fecac409", + "test@test.com", "children": []}, {"id": "user_488e391395f4416196a31965fecac409", "object": "User", "parent_id": null, "name": "Firstname Lastname", "phone_number": - "REDACTED", "verified": true, "created_at": "2022-05-02T18:48:22Z", "balance": + "8888888888", "verified": true, "created_at": "2022-05-02T18:48:22Z", "balance": "0.00000", "price_per_shipment": "0.00000", "recharge_amount": "100.00", "secondary_recharge_amount": "100.00", "recharge_threshold": "0.00", "has_billing_method": true, "cc_fee_rate": "0.0325", "default_insurance_amount": "50.00", "insurance_fee_rate": "0.005", - "insurance_fee_minimum": "0.25", "email": "REDACTED", "children": ["REDACTED"]}]' + "insurance_fee_minimum": "0.25", "email": "email@example.com", "children": + []}]}' headers: cache-control: - no-cache, no-store content-length: - - '2534' + - '2569' content-type: - application/json; charset=utf-8 etag: - - W/"a150cbb12f3c14f2526250370c45d394" + - W/"5b291a65ba7838e42637470e6420bc5f" expires: - '0' pragma: @@ -75,20 +76,21 @@ interactions: x-download-options: - noopen x-ep-request-uuid: - - 2f0f5533627bcca2e779942e000c7daf + - 4412a3eb62c8820ef68a4a88003a3982 x-frame-options: - SAMEORIGIN x-node: - - bigweb8nuq + - bigweb9nuq x-permitted-cross-domain-policies: - none x-proxied: - - intlb2nuq fde591f008 - - extlb2nuq c51cdb8bf2 + - intlb1nuq 403f17ff97 + - intlb2wdc 403f17ff97 + - extlb4wdc 403f17ff97 x-runtime: - - '0.196335' + - '0.170155' x-version-label: - - easypost-202205110022-b4df6b5700-master + - easypost-202207081829-74359e0846-master x-xss-protection: - 1; mode=block status: diff --git a/tests/test_referral.py b/tests/test_referral.py index df496a99..63dee3b8 100644 --- a/tests/test_referral.py +++ b/tests/test_referral.py @@ -40,8 +40,11 @@ def test_referral_user_all(prod_api_key, page_size): """This test requires a partner user's production API key via EASYPOST_PROD_API_KEY.""" referral_users = easypost.beta.Referral.all(page_size=page_size) - assert len(referral_users) <= page_size - assert all(isinstance(referral_user, easypost.User) for referral_user in referral_users) + referral_users_array = referral_users["referral_customers"] + + assert len(referral_users_array) <= page_size + assert referral_users["has_more"] is not None + assert all(isinstance(referral_user, easypost.User) for referral_user in referral_users_array) # PyVCR is having troubles matching the body of the form-encoded data here, override the default