Ejemplo n.º 1
0
	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")
Ejemplo n.º 2
0
    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")
Ejemplo n.º 3
0
    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")
Ejemplo n.º 4
0
    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()
Ejemplo n.º 5
0
    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)
Ejemplo n.º 6
0
	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)
Ejemplo n.º 7
0
    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])