Skip to content

Commit

Permalink
Add and fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
remi-stripe committed Sep 2, 2020
1 parent 3af35bf commit b0a1eb0
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 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.95.0
- STRIPE_MOCK_VERSION=0.98.0

before_install:
# Unpack and start stripe-mock so that the test suite can talk to it
Expand Down
9 changes: 8 additions & 1 deletion tests/api_resources/issuing/test_dispute.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class TestDispute(object):
def test_is_creatable(self, request_mock):
resource = stripe.issuing.Dispute.create()
resource = stripe.issuing.Dispute.create(transaction="ipi_123")
request_mock.assert_requested("post", "/v1/issuing/disputes")
assert isinstance(resource, stripe.issuing.Dispute)

Expand All @@ -31,3 +31,10 @@ def test_is_retrievable(self, request_mock):
"get", "/v1/issuing/disputes/%s" % TEST_RESOURCE_ID
)
assert isinstance(resource, stripe.issuing.Dispute)

def test_is_submittable(self, request_mock):
resource = stripe.issuing.Dispute.submit(TEST_RESOURCE_ID)
request_mock.assert_requested(
"post", "/v1/issuing/disputes/%s/submit" % TEST_RESOURCE_ID
)
assert isinstance(resource, stripe.issuing.Dispute)
13 changes: 3 additions & 10 deletions tests/api_resources/test_list_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,10 @@ def test_create(self, request_mock, list_object):
def test_create_maintains_list_properties(self, request_mock, list_object):
# Testing with real requests because our mock makes it impossible to
# test otherwise
customer = stripe.Customer.retrieve(
"cus_123", api_key="sk_test_custom"
)

res = customer.sources.create(source="tok_123")

charge = stripe.Charge.retrieve("ch_123", api_key="sk_test_custom")
res = charge.refunds.create(amount=123)
request_mock.assert_requested(
"post",
"/v1/customers/cus_123/sources",
{"source": "tok_123"},
None,
"post", "/v1/charges/ch_123/refunds", {"amount": 123}, None,
)
assert res.api_key == "sk_test_custom"

Expand Down
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.95.0"
MOCK_MINIMUM_VERSION = "0.98.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 b0a1eb0

Please sign in to comment.