def test_get_api_client_with_settings_url(self): with u1testutils.django.patch_settings( PAY_SERVER_URL='http://settings.pay.local:8000'): api_client = api.APIClient() self.assertEquals( api_client.client._service_root, 'http://settings.pay.local:8000/api/2.0/')
def test_new_credit_card_added_with_default_unattended_value(self): shop_id = 'TEST' api_client = api.APIClient() with mock.patch('payclient.PaymentServiceAPI.new_credit_card') \ as mock_api_call: api_client.add_new_credit_card( shop_id, self.user, self.credit_card, self.billing_address) mock_api_call.assert_called_with( data=payclient.CreditCardRequest.from_data_objects( shop_id, self.user.openid, self.credit_card, self.billing_address, False))
def test_get_api_client_with_argument_url_and_trailing_slash(self): pay_server_url = 'http://argument.pay.local:8000/' api_client = api.APIClient(pay_server_url) self.assertEquals( api_client.client._service_root, 'http://argument.pay.local:8000/api/2.0/')
def test_get_api_client_with_default_url(self): api_client = api.APIClient() self.assertEquals( api_client.client._service_root, 'http://localhost:8000/api/2.0/')
def test_get_api_client(self): api_client = api.APIClient() self.assertTrue( isinstance(api_client.client, payclient.PaymentServiceAPI))