def test_api_call_bad_customer(self): exception_message = "Cards must be manipulated through a Customer. Pass a Customer object into this call." with self.assertRaisesMessage(StripeObjectManipulationException, exception_message): Card._api_create(customer="fish") with self.assertRaisesMessage(StripeObjectManipulationException, exception_message): Card.api_list(customer="fish")
def test_api_call_bad_account(self): exception_message = ( "Cards must be manipulated through a Stripe Connected Account. " "Pass an Account object into this call.") with self.assertRaisesMessage(StripeObjectManipulationException, exception_message): Card._api_create(account="fish") with self.assertRaisesMessage(StripeObjectManipulationException, exception_message): Card.api_list(account="fish")
def test_api_call_no_customer_and_no_account(self): exception_message = ( "Cards must be manipulated through either a Stripe Connected Account or a customer. " "Pass a Customer or an Account object into this call.") with self.assertRaisesMessage(StripeObjectManipulationException, exception_message): Card._api_create() with self.assertRaisesMessage(StripeObjectManipulationException, exception_message): Card.api_list()
def test_api_list(self, customer_retrieve_mock): card_list = Card.api_list(customer=self.customer) self.assertEqual([FAKE_CARD, FAKE_CARD_V], card_list)
def test_api_list(self, customer_retrieve_mock): card_list = Card.api_list(customer=self.customer) self.assertCountEqual([FAKE_CARD, FAKE_CARD_III], [i for i in card_list])