def test_addresses_list_for_business_two(self): """Tests when two funding source addresses should be returned.""" business = self.client.businesses.create({}) address_one = FundingSources.get_card_holder_address_model() address_one["business_token"] = business.token address_two = { "business_token": business.token, "first_name": "O", "last_name": "PD", "address_1": "455 7th St.", "city": "Oakland", "state": "CA", "zip": "94612", "country": "USA" } self.client.funding_sources.addresses.create(address_one) self.client.funding_sources.addresses.create(address_two) addresses = self.client.funding_sources.addresses.list_for_business( business.token) self.assertEqual(len(addresses), 2, 'Incorrect number of addresses returned') if addresses[0].first_name == address_one['first_name']: verify_card_holder_address_response( self, addresses[0], address_one) verify_card_holder_address_response( self, addresses[1], address_two) else: verify_card_holder_address_response( self, addresses[1], address_one) verify_card_holder_address_response( self, addresses[0], address_two)
def test_addresses_list_for_user_two(self): """Tests when two funding source addresses should be returned.""" card_holder_address_one = FundingSources.get_card_holder_address_model( ) card_holder_address_one["user_token"] = self.user.token card_holder_address_two = { "user_token": self.user.token, "first_name": "O", "last_name": "PD", "address_1": "455 7th St.", "city": "Oakland", "state": "CA", "zip": "94612", "country": "USA" } self.client.funding_sources.addresses.create(card_holder_address_one) self.client.funding_sources.addresses.create(card_holder_address_two) addresses = self.client.funding_sources.addresses.list_for_user( self.user.token) self.assertEqual(len(addresses), 2, 'Unexpected number of addresses retrieved') if addresses[0].first_name == card_holder_address_one['first_name']: verify_card_holder_address_response(self, addresses[0], card_holder_address_one) verify_card_holder_address_response(self, addresses[1], card_holder_address_two) else: verify_card_holder_address_response(self, addresses[1], card_holder_address_one) verify_card_holder_address_response(self, addresses[0], card_holder_address_two)
def test_addresses_list_for_user_one(self): """Tests when one funding source address should be returned.""" card_holder_address_model = FundingSources.get_card_holder_address_model( ) card_holder_address_model["user_token"] = self.user.token self.client.funding_sources.addresses.create(card_holder_address_model) self.create_card(self.create_card_product(), self.user) addresses = self.client.funding_sources.addresses.list_for_user( self.user.token) self.assertEqual(len(addresses), 1, 'Unexpected number of addresses retrieved') verify_card_holder_address_response(self, addresses[0], card_holder_address_model) with self.subTest('Address defined is not the default'): self.assertTrue(addresses[0].is_default_address)