Skip to content

Commit

Permalink
Upgrade stripe-mock to 0.30.0
Browse files Browse the repository at this point in the history
Let's make sure that everything is still working on the latest version
of stripe-mock.

stripe-mock 0.30.0 brought in additional validation of query parameters,
so it caught a few places where the Python test suite wasn't making
valid requests. I've fixed up a few tests around invoices and
subscription items to add parameters that should have been there.
  • Loading branch information
brandur committed Aug 30, 2018
1 parent 3323380 commit a585c50
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ cache:

env:
global:
- STRIPE_MOCK_VERSION=0.25.0
# If changing this number, please also change it in `tests/conftest.py`.
- STRIPE_MOCK_VERSION=0.30.0

before_install:
# Unpack and start stripe-mock so that the test suite can talk to it
Expand Down
6 changes: 5 additions & 1 deletion tests/api_resources/test_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ def test_can_pay(self, request_mock):
assert isinstance(resource, stripe.Invoice)

def test_can_upcoming(self, request_mock):
resource = stripe.Invoice.upcoming()
resource = stripe.Invoice.upcoming(
customer="cus_123"
)
request_mock.assert_requested(
'get',
'/v1/invoices/upcoming'
Expand All @@ -73,6 +75,7 @@ def test_can_upcoming(self, request_mock):

def test_can_upcoming_and_subscription_items(self, request_mock):
resource = stripe.Invoice.upcoming(
customer="cus_123",
subscription_items=[
{"plan": "foo", "quantity": 3}
]
Expand All @@ -81,6 +84,7 @@ def test_can_upcoming_and_subscription_items(self, request_mock):
'get',
'/v1/invoices/upcoming',
{
'customer': 'cus_123',
'subscription_items': {
"0": {
"plan": "foo",
Expand Down
9 changes: 7 additions & 2 deletions tests/api_resources/test_subscription_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@

class TestSubscriptionItem(object):
def test_is_listable(self, request_mock):
resources = stripe.SubscriptionItem.list()
resources = stripe.SubscriptionItem.list(
subscription="sub_123"
)
request_mock.assert_requested(
'get',
'/v1/subscription_items'
'/v1/subscription_items',
{
'subscription': 'sub_123',
}
)
assert isinstance(resources.data, list)
assert isinstance(resources.data[0], stripe.SubscriptionItem)
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from tests.request_mock import RequestMock


MOCK_MINIMUM_VERSION = '0.25.0'
MOCK_MINIMUM_VERSION = '0.30.0'
MOCK_PORT = os.environ.get('STRIPE_MOCK_PORT', 12111)


Expand Down

0 comments on commit a585c50

Please sign in to comment.