From 9def78f1e60fa75c20b5ba58e37bd55d9d8122fe Mon Sep 17 00:00:00 2001 From: Richard Marmorstein Date: Thu, 13 May 2021 19:05:17 -0400 Subject: [PATCH] Tests --- .github/workflows/python-package.yml | 4 ++-- .travis.yml | 2 +- tests/api_resources/test_payment_intent.py | 19 +++++++++++++++++++ tests/api_resources/test_setup_intent.py | 19 +++++++++++++++++++ tests/conftest.py | 2 +- 5 files changed, 42 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 9f11221f1..f7d3ab1db 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -35,7 +35,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [2.7, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, pypy-2.7, pypy-3.7] + python-version: [3.5, 3.6, 3.7, 3.8, 3.9, pypy-2.7, pypy-3.7] steps: - uses: actions/checkout@v2 @@ -62,7 +62,7 @@ jobs: # not fully supported by github actions yet, as of Feb 2021 # https://github.com/actions/cache/issues/81 - name: Start stripe-mock - run: docker run -d -p 12111-12112:12111-12112 stripemock/stripe-mock && sleep 5 + run: docker pull stripemock/stripe-mock && docker run -d -p 12111-12112:12111-12112 stripemock/stripe-mock && sleep 5 - name: Test with pytest run: make test diff --git a/.travis.yml b/.travis.yml index 7a489001e..a0a5d78a8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,7 +28,7 @@ cache: env: global: # If changing this number, please also change it in `tests/conftest.py`. - - STRIPE_MOCK_VERSION=0.103.0 + - STRIPE_MOCK_VERSION=0.104.0 before_install: # Unpack and start stripe-mock so that the test suite can talk to it diff --git a/tests/api_resources/test_payment_intent.py b/tests/api_resources/test_payment_intent.py index 05103a26d..531a7ce61 100644 --- a/tests/api_resources/test_payment_intent.py +++ b/tests/api_resources/test_payment_intent.py @@ -94,3 +94,22 @@ def test_can_confirm_classmethod(self, request_mock): "post", "/v1/payment_intents/%s/confirm" % TEST_RESOURCE_ID ) assert isinstance(resource, stripe.PaymentIntent) + + def test_can_verify_microdeposits(self, request_mock): + resource = stripe.PaymentIntent.retrieve(TEST_RESOURCE_ID) + resource.verify_microdeposits(client_secret="secret", amounts=[1, 2]) + request_mock.assert_requested( + "post", + "/v1/payment_intents/%s/verify_microdeposits" % TEST_RESOURCE_ID, + ) + assert isinstance(resource, stripe.PaymentIntent) + + def test_can_verifymicrodeposits_classmethod(self, request_mock): + resource = stripe.PaymentIntent.verify_microdeposits( + TEST_RESOURCE_ID, client_secret="secret", amounts=[1, 2] + ) + request_mock.assert_requested( + "post", + "/v1/payment_intents/%s/verify_microdeposits" % TEST_RESOURCE_ID, + ) + assert isinstance(resource, stripe.PaymentIntent) diff --git a/tests/api_resources/test_setup_intent.py b/tests/api_resources/test_setup_intent.py index 02d6eecf2..181a74a1d 100644 --- a/tests/api_resources/test_setup_intent.py +++ b/tests/api_resources/test_setup_intent.py @@ -77,3 +77,22 @@ def test_can_confirm_classmethod(self, request_mock): "post", "/v1/setup_intents/%s/confirm" % TEST_RESOURCE_ID ) assert isinstance(resource, stripe.SetupIntent) + + def test_can_verify_microdeposits(self, request_mock): + resource = stripe.SetupIntent.retrieve(TEST_RESOURCE_ID) + resource.verify_microdeposits(amounts=[1, 2]) + request_mock.assert_requested( + "post", + "/v1/setup_intents/%s/verify_microdeposits" % TEST_RESOURCE_ID, + ) + assert isinstance(resource, stripe.SetupIntent) + + def test_can_verifymicrodeposits_classmethod(self, request_mock): + resource = stripe.SetupIntent.verify_microdeposits( + TEST_RESOURCE_ID, amounts=[1, 2] + ) + request_mock.assert_requested( + "post", + "/v1/setup_intents/%s/verify_microdeposits" % TEST_RESOURCE_ID, + ) + assert isinstance(resource, stripe.SetupIntent) diff --git a/tests/conftest.py b/tests/conftest.py index e4a8188f9..3ac420c85 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -16,7 +16,7 @@ # When changing this number, don't forget to change it in `.travis.yml` too. -MOCK_MINIMUM_VERSION = "0.103.0" +MOCK_MINIMUM_VERSION = "0.104.0" # Starts stripe-mock if an OpenAPI spec override is found in `openapi/`, and # otherwise fall back to `STRIPE_MOCK_PORT` or 12111.