Open source

This commit is contained in:
Kaan Soral
2023-10-15 13:06:58 +03:00
parent 256ce800e7
commit 553b121f17
2633 changed files with 769945 additions and 454 deletions
+35
View File
@@ -0,0 +1,35 @@
import libraries.stripe
from libraries.stripe.test.helper import (
StripeApiTestCase, MyCreatable
)
class CreateableAPIResourceTests(StripeApiTestCase):
def test_create(self):
self.mock_response({
'object': 'charge',
'foo': 'bar',
})
res = MyCreatable.create()
self.requestor_mock.request.assert_called_with(
'post', '/v1/mycreatables', {}, None)
self.assertTrue(isinstance(res, libraries.stripe.Charge))
self.assertEqual('bar', res.foo)
def test_idempotent_create(self):
self.mock_response({
'object': 'charge',
'foo': 'bar',
})
res = MyCreatable.create(idempotency_key='foo')
self.requestor_mock.request.assert_called_with(
'post', '/v1/mycreatables', {}, {'Idempotency-Key': 'foo'})
self.assertTrue(isinstance(res, libraries.stripe.Charge))
self.assertEqual('bar', res.foo)