/
test_application_fees.py
72 lines (59 loc) · 1.91 KB
/
test_application_fees.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import stripe
from stripe.test.helper import StripeResourceTest
class ApplicationFeeTest(StripeResourceTest):
def test_list_application_fees(self):
stripe.ApplicationFee.all()
self.requestor_mock.request.assert_called_with(
'get',
'/v1/application_fees',
{}
)
class ApplicationFeeRefundTest(StripeResourceTest):
def test_fetch_refund(self):
fee = stripe.ApplicationFee.construct_from({
'id': 'fee_get_refund',
'refunds': {
'object': 'list',
'url': '/v1/application_fees/fee_get_refund/refunds',
}
}, 'api_key')
fee.refunds.retrieve("ref_get")
self.requestor_mock.request.assert_called_with(
'get',
'/v1/application_fees/fee_get_refund/refunds/ref_get',
{},
None
)
def test_list_refunds(self):
fee = stripe.ApplicationFee.construct_from({
'id': 'fee_get_refund',
'refunds': {
'object': 'list',
'url': '/v1/application_fees/fee_get_refund/refunds',
}
}, 'api_key')
fee.refunds.all()
self.requestor_mock.request.assert_called_with(
'get',
'/v1/application_fees/fee_get_refund/refunds',
{},
None
)
def test_update_refund(self):
refund = stripe.resource.ApplicationFeeRefund.construct_from({
'id': "ref_update",
'fee': "fee_update",
'metadata': {},
}, 'api_key')
refund.metadata["key"] = "value"
refund.save()
self.requestor_mock.request.assert_called_with(
'post',
'/v1/application_fees/fee_update/refunds/ref_update',
{
'metadata': {
'key': 'value',
}
},
None
)