Skip to content

Commit

Permalink
Add tests for child resources.
Browse files Browse the repository at this point in the history
  • Loading branch information
dcr-stripe committed Oct 12, 2021
1 parent 433577d commit 2ffe033
Showing 1 changed file with 100 additions and 0 deletions.
100 changes: 100 additions & 0 deletions tests/test_generated_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,16 @@ def test_creditnote_list(self, request_mock):
stripe.CreditNote.list(limit=3)
request_mock.assert_requested("get", "/v1/credit_notes")

def test_customer_customerbalancetransaction_retrieve(self, request_mock):
stripe.Customer.retrieve_balance_transaction(
"cus_xxxxxxxxxxxxx",
"cbtxn_xxxxxxxxxxxxx",
)
request_mock.assert_requested(
"get",
"/v1/customers/cus_xxxxxxxxxxxxx/balance_transactions/cbtxn_xxxxxxxxxxxxx",
)

def test_billing_portal_session_create(self, request_mock):
stripe.billing_portal.Session.create(
customer="cus_xxxxxxxxxxxxx",
Expand Down Expand Up @@ -573,6 +583,15 @@ def test_billing_portal_configuration_list(self, request_mock):
"get", "/v1/billing_portal/configurations"
)

def test_customer_taxid_retrieve(self, request_mock):
stripe.Customer.retrieve_tax_id(
"cus_xxxxxxxxxxxxx", "txi_xxxxxxxxxxxxx"
)
request_mock.assert_requested(
"get",
"/v1/customers/cus_xxxxxxxxxxxxx/tax_ids/txi_xxxxxxxxxxxxx",
)

def test_invoice_create(self, request_mock):
stripe.Invoice.create(customer="cus_xxxxxxxxxxxxx")
request_mock.assert_requested("post", "/v1/invoices")
Expand Down Expand Up @@ -911,6 +930,47 @@ def test_applicationfee_list(self, request_mock):
stripe.ApplicationFee.list(limit=3)
request_mock.assert_requested("get", "/v1/application_fees")

def test_applicationfee_feerefund_retrieve(self, request_mock):
stripe.ApplicationFee.retrieve_refund(
"fee_xxxxxxxxxxxxx",
"fr_xxxxxxxxxxxxx",
)
request_mock.assert_requested(
"get",
"/v1/application_fees/fee_xxxxxxxxxxxxx/refunds/fr_xxxxxxxxxxxxx",
)

def test_applicationfee_feerefund_update(self, request_mock):
stripe.ApplicationFee.modify_refund(
"fee_xxxxxxxxxxxxx",
"fr_xxxxxxxxxxxxx",
metadata={"order_id": "6735"},
)
request_mock.assert_requested(
"post",
"/v1/application_fees/fee_xxxxxxxxxxxxx/refunds/fr_xxxxxxxxxxxxx",
)

def test_account_capability_retrieve(self, request_mock):
stripe.Account.retrieve_capability(
"acct_xxxxxxxxxxxxx", "card_payments"
)
request_mock.assert_requested(
"get",
"/v1/accounts/acct_xxxxxxxxxxxxx/capabilities/card_payments",
)

def test_account_capability_update(self, request_mock):
stripe.Account.modify_capability(
"acct_xxxxxxxxxxxxx",
"card_payments",
requested=True,
)
request_mock.assert_requested(
"post",
"/v1/accounts/acct_xxxxxxxxxxxxx/capabilities/card_payments",
)

def test_countryspec_list(self, request_mock):
stripe.CountrySpec.list(limit=3)
request_mock.assert_requested("get", "/v1/country_specs")
Expand All @@ -919,6 +979,26 @@ def test_countryspec_retrieve(self, request_mock):
stripe.CountrySpec.retrieve("US")
request_mock.assert_requested("get", "/v1/country_specs/US")

def test_account_person_retrieve(self, request_mock):
stripe.Account.retrieve_person(
"acct_xxxxxxxxxxxxx", "person_xxxxxxxxxxxxx"
)
request_mock.assert_requested(
"get",
"/v1/accounts/acct_xxxxxxxxxxxxx/persons/person_xxxxxxxxxxxxx",
)

def test_account_person_update(self, request_mock):
stripe.Account.modify_person(
"acct_xxxxxxxxxxxxx",
"person_xxxxxxxxxxxxx",
metadata={"order_id": "6735"},
)
request_mock.assert_requested(
"post",
"/v1/accounts/acct_xxxxxxxxxxxxx/persons/person_xxxxxxxxxxxxx",
)

def test_topup_create(self, request_mock):
stripe.Topup.create(
amount=2000,
Expand Down Expand Up @@ -969,6 +1049,26 @@ def test_transfer_list(self, request_mock):
stripe.Transfer.list(limit=3)
request_mock.assert_requested("get", "/v1/transfers")

def test_transfer_transferreversal_retrieve(self, request_mock):
stripe.Transfer.retrieve_reversal(
"tr_xxxxxxxxxxxxx", "trr_xxxxxxxxxxxxx"
)
request_mock.assert_requested(
"get",
"/v1/transfers/tr_xxxxxxxxxxxxx/reversals/trr_xxxxxxxxxxxxx",
)

def test_transfer_transferreversal_update(self, request_mock):
stripe.Transfer.modify_reversal(
"tr_xxxxxxxxxxxxx",
"trr_xxxxxxxxxxxxx",
metadata={"order_id": "6735"},
)
request_mock.assert_requested(
"post",
"/v1/transfers/tr_xxxxxxxxxxxxx/reversals/trr_xxxxxxxxxxxxx",
)

def test_radar_earlyfraudwarning_retrieve(self, request_mock):
stripe.radar.EarlyFraudWarning.retrieve("issfr_xxxxxxxxxxxxx")
request_mock.assert_requested(
Expand Down

0 comments on commit 2ffe033

Please sign in to comment.