python3 compatibility + webapp to flask refactoring

This commit is contained in:
Kaan Soral
2024-01-27 20:37:44 +03:00
parent 5180a9c31c
commit 53b3de28ab
81 changed files with 11213 additions and 1085 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)