Debian Codegraph @

tests/api_resources/billing_portal/test_configuration.py

raw
1 import stripe
2
3
4 TEST_RESOURCE_ID = "bpc_123"
5
6
7 class TestConfiguration(object):
8 def test_is_creatable(self, http_client_mock):
9 resource = stripe.billing_portal.Configuration.create(
10 business_profile={
11 "privacy_policy_url": "https://example.com/privacy",
12 "terms_of_service_url": "https://example.com/tos",
13 },
14 features={
15 "customer_update": {
16 "allowed_updates": ["address"],
17 "enabled": True,
18 }
19 },
20 )
21 http_client_mock.assert_requested(
22 "post",
23 path="/v1/billing_portal/configurations",
24 post_data="business_profile[privacy_policy_url]=https://example.com/privacy&business_profile[terms_of_service_url]=https://example.com/tos&features[customer_update][allowed_updates][0]=address&features[customer_update][enabled]=true",
25 )
26 assert isinstance(resource, stripe.billing_portal.Configuration)
27
28 def test_is_retrievable(self, http_client_mock):
29 resource = stripe.billing_portal.Configuration.retrieve(
30 TEST_RESOURCE_ID
31 )
32 http_client_mock.assert_requested(
33 "get",
34 path="/v1/billing_portal/configurations/%s" % (TEST_RESOURCE_ID),
35 )
36 assert isinstance(resource, stripe.billing_portal.Configuration)
37
38 def test_is_modifiable(self, http_client_mock):
39 resource = stripe.billing_portal.Configuration.modify(TEST_RESOURCE_ID)
40 http_client_mock.assert_requested(
41 "post",
42 path="/v1/billing_portal/configurations/%s" % (TEST_RESOURCE_ID),
43 )
44 assert isinstance(resource, stripe.billing_portal.Configuration)
45
46 def test_is_listable(self, http_client_mock):
47 resource = stripe.billing_portal.Configuration.list()
48 http_client_mock.assert_requested(
49 "get", path="/v1/billing_portal/configurations"
50 )
51 assert isinstance(
52 resource.data[0], stripe.billing_portal.Configuration
53 )