Skip to content

Commit

Permalink
Merge pull request #681 from stripe/remi/codegen-3854362
Browse files Browse the repository at this point in the history
Add support for the `SetupAttempt` resource and List API
  • Loading branch information
remi-stripe authored Sep 30, 2020
2 parents 9f76d87 + 5a3ff92 commit 91421dc
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ cache:
env:
global:
# If changing this number, please also change it in `tests/conftest.py`.
- STRIPE_MOCK_VERSION=0.98.0
- STRIPE_MOCK_VERSION=0.99.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/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
from stripe.api_resources.refund import Refund
from stripe.api_resources.reversal import Reversal
from stripe.api_resources.review import Review
from stripe.api_resources.setup_attempt import SetupAttempt
from stripe.api_resources.setup_intent import SetupIntent
from stripe.api_resources.sku import SKU
from stripe.api_resources.source import Source
Expand Down
7 changes: 7 additions & 0 deletions stripe/api_resources/setup_attempt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from __future__ import absolute_import, division, print_function

from stripe.api_resources.abstract import ListableAPIResource


class SetupAttempt(ListableAPIResource):
OBJECT_NAME = "setup_attempt"
1 change: 1 addition & 0 deletions stripe/object_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
api_resources.reporting.ReportType.OBJECT_NAME: api_resources.reporting.ReportType,
api_resources.Reversal.OBJECT_NAME: api_resources.Reversal,
api_resources.Review.OBJECT_NAME: api_resources.Review,
api_resources.SetupAttempt.OBJECT_NAME: api_resources.SetupAttempt,
api_resources.SetupIntent.OBJECT_NAME: api_resources.SetupIntent,
api_resources.sigma.ScheduledQueryRun.OBJECT_NAME: api_resources.sigma.ScheduledQueryRun,
api_resources.SKU.OBJECT_NAME: api_resources.SKU,
Expand Down
2 changes: 1 addition & 1 deletion tests/api_resources/test_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_is_retrievable(self, request_mock):
assert isinstance(resource, stripe.Product)

def test_is_creatable(self, request_mock):
resource = stripe.Product.create(name="NAME", type="good")
resource = stripe.Product.create(name="NAME")
request_mock.assert_requested("post", "/v1/products")
assert isinstance(resource, stripe.Product)

Expand Down
11 changes: 11 additions & 0 deletions tests/api_resources/test_setup_attempt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from __future__ import absolute_import, division, print_function

import stripe


class TestSetupAttempt(object):
def test_is_listable(self, request_mock):
resources = stripe.SetupAttempt.list(setup_intent="seti_123")
request_mock.assert_requested("get", "/v1/setup_attempts")
assert isinstance(resources.data, list)
assert isinstance(resources.data[0], stripe.SetupAttempt)
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.98.0"
MOCK_MINIMUM_VERSION = "0.99.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

0 comments on commit 91421dc

Please sign in to comment.