-
Notifications
You must be signed in to change notification settings - Fork 408
/
test_listable.py
35 lines (29 loc) · 947 Bytes
/
test_listable.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import stripe
from stripe.test.helper import (
StripeApiTestCase, MyListable
)
class ListableAPIResourceTests(StripeApiTestCase):
def test_all(self):
self.mock_response({
'object': 'list',
'data': [
{
'object': 'charge',
'name': 'jose',
},
{
'object': 'charge',
'name': 'curly',
}
],
'url': '/v1/charges',
'has_more': False,
})
res = MyListable.list()
self.requestor_mock.request.assert_called_with(
'get', '/v1/mylistables', {})
self.assertEqual(2, len(res.data))
self.assertTrue(all(isinstance(obj, stripe.Charge)
for obj in res.data))
self.assertEqual('jose', res.data[0].name)
self.assertEqual('curly', res.data[1].name)