Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Updates #713

Merged
merged 6 commits into from
Feb 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ cache:
env:
global:
# If changing this number, please also change it in `tests/conftest.py`.
- STRIPE_MOCK_VERSION=0.101.0
- STRIPE_MOCK_VERSION=0.103.0

before_install:
# Unpack and start stripe-mock so that the test suite can talk to it
Expand Down
1 change: 1 addition & 0 deletions stripe/api_resources/billing_portal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

# flake8: noqa

from stripe.api_resources.billing_portal.configuration import Configuration
from stripe.api_resources.billing_portal.session import Session
11 changes: 11 additions & 0 deletions stripe/api_resources/billing_portal/configuration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from __future__ import absolute_import, division, print_function

from stripe.api_resources.abstract import CreateableAPIResource
from stripe.api_resources.abstract import ListableAPIResource
from stripe.api_resources.abstract import UpdateableAPIResource


class Configuration(
CreateableAPIResource, ListableAPIResource, UpdateableAPIResource
):
OBJECT_NAME = "billing_portal.configuration"
1 change: 1 addition & 0 deletions stripe/object_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
api_resources.Balance.OBJECT_NAME: api_resources.Balance,
api_resources.BalanceTransaction.OBJECT_NAME: api_resources.BalanceTransaction,
api_resources.BankAccount.OBJECT_NAME: api_resources.BankAccount,
api_resources.billing_portal.Configuration.OBJECT_NAME: api_resources.billing_portal.Configuration,
api_resources.billing_portal.Session.OBJECT_NAME: api_resources.billing_portal.Session,
api_resources.BitcoinReceiver.OBJECT_NAME: api_resources.BitcoinReceiver,
api_resources.BitcoinTransaction.OBJECT_NAME: api_resources.BitcoinTransaction,
Expand Down
51 changes: 51 additions & 0 deletions tests/api_resources/billing_portal/test_configuration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
from __future__ import absolute_import, division, print_function

import stripe


TEST_RESOURCE_ID = "bpc_123"


class TestConfiguration(object):
def test_is_creatable(self, request_mock):
resource = stripe.billing_portal.Configuration.create(
business_profile={
"privacy_policy_url": "https://example.com/privacy",
"terms_of_service_url": "https://example.com/tos",
},
features={
"customer_update": {
"allowed_updates": ["address"],
"enabled": True,
}
},
)
request_mock.assert_requested(
"post", "/v1/billing_portal/configurations"
)
assert isinstance(resource, stripe.billing_portal.Configuration)

def test_is_retrievable(self, request_mock):
resource = stripe.billing_portal.Configuration.retrieve(
TEST_RESOURCE_ID
)
request_mock.assert_requested(
"get", "/v1/billing_portal/configurations/%s" % (TEST_RESOURCE_ID)
)
assert isinstance(resource, stripe.billing_portal.Configuration)

def test_is_modifiable(self, request_mock):
resource = stripe.billing_portal.Configuration.modify(TEST_RESOURCE_ID)
request_mock.assert_requested(
"post", "/v1/billing_portal/configurations/%s" % (TEST_RESOURCE_ID)
)
assert isinstance(resource, stripe.billing_portal.Configuration)

def test_is_listable(self, request_mock):
resource = stripe.billing_portal.Configuration.list()
request_mock.assert_requested(
"get", "/v1/billing_portal/configurations"
)
assert isinstance(
resource.data[0], stripe.billing_portal.Configuration
)
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


# When changing this number, don't forget to change it in `.travis.yml` too.
MOCK_MINIMUM_VERSION = "0.101.0"
MOCK_MINIMUM_VERSION = "0.103.0"

# Starts stripe-mock if an OpenAPI spec override is found in `openapi/`, and
# otherwise fall back to `STRIPE_MOCK_PORT` or 12111.
Expand Down