Ejemplo n.º 1
0
    def test_api_call_bad_customer(self):
        exception_message = (
            "BankAccounts must be manipulated through a Customer. "
            "Pass a Customer object into this call.")

        with self.assertRaisesMessage(StripeObjectManipulationException,
                                      exception_message):
            BankAccount._api_create(customer="fish")

        with self.assertRaisesMessage(StripeObjectManipulationException,
                                      exception_message):
            BankAccount.api_list(customer="fish")
Ejemplo n.º 2
0
    def test_api_call_bad_account(self):
        exception_message = (
            "BankAccounts must be manipulated through a Stripe Connected Account. "
            "Pass an Account object into this call.")

        with self.assertRaisesMessage(StripeObjectManipulationException,
                                      exception_message):
            BankAccount._api_create(account="fish")

        with self.assertRaisesMessage(StripeObjectManipulationException,
                                      exception_message):
            BankAccount.api_list(account="fish")
Ejemplo n.º 3
0
    def test_api_call_no_customer_and_no_account(self):
        exception_message = (
            "BankAccounts 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):
            BankAccount._api_create()

        with self.assertRaisesMessage(StripeObjectManipulationException,
                                      exception_message):
            BankAccount.api_list()
Ejemplo n.º 4
0
    def test_api_list(self, customer_retrieve_mock):
        bank_account_list = BankAccount.api_list(customer=self.customer)

        self.assertEqual([FAKE_BANK_ACCOUNT_SOURCE], bank_account_list)