mirror of
https://github.com/gooba42/adventureland.git
synced 2026-10-24 13:40:13 -05:00
stripe fixes
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import libraries.stripe
|
||||
from libraries.stripe.test.helper import StripeResourceTest
|
||||
import libraries.stripe3
|
||||
from libraries.stripe3.test.helper import StripeResourceTest
|
||||
|
||||
|
||||
class AccountTest(StripeResourceTest):
|
||||
|
||||
def test_retrieve_account_deprecated(self):
|
||||
libraries.stripe.Account.retrieve()
|
||||
libraries.stripe3.Account.retrieve()
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'get',
|
||||
@@ -15,7 +15,7 @@ class AccountTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_retrieve_account(self):
|
||||
libraries.stripe.Account.retrieve('acct_foo')
|
||||
libraries.stripe3.Account.retrieve('acct_foo')
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'get',
|
||||
'/v1/accounts/acct_foo',
|
||||
@@ -24,7 +24,7 @@ class AccountTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_list_accounts(self):
|
||||
libraries.stripe.Account.list()
|
||||
libraries.stripe3.Account.list()
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'get',
|
||||
'/v1/accounts',
|
||||
@@ -37,7 +37,7 @@ class AccountTest(StripeResourceTest):
|
||||
'first_name': 'Joe',
|
||||
'last_name': 'Smith',
|
||||
}
|
||||
libraries.stripe.Account.create(legal_entity=pii)
|
||||
libraries.stripe3.Account.create(legal_entity=pii)
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'post',
|
||||
'/v1/accounts',
|
||||
@@ -48,7 +48,7 @@ class AccountTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_update_account(self):
|
||||
acct = libraries.stripe.Account.construct_from({
|
||||
acct = libraries.stripe3.Account.construct_from({
|
||||
'id': 'acct_update',
|
||||
'legal_entity': {'first_name': 'Joe'},
|
||||
}, 'api_key')
|
||||
@@ -67,7 +67,7 @@ class AccountTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_account_delete_bank_account(self):
|
||||
source = libraries.stripe.BankAccount.construct_from({
|
||||
source = libraries.stripe3.BankAccount.construct_from({
|
||||
'account': 'acc_delete_ba',
|
||||
'id': 'ba_delete_ba',
|
||||
}, 'api_key')
|
||||
@@ -88,7 +88,7 @@ class AccountTest(StripeResourceTest):
|
||||
},
|
||||
})
|
||||
|
||||
obj = libraries.stripe.Account.construct_from({
|
||||
obj = libraries.stripe3.Account.construct_from({
|
||||
'id': 'acct_reject'
|
||||
}, 'mykey')
|
||||
|
||||
@@ -111,7 +111,7 @@ class AccountTest(StripeResourceTest):
|
||||
},
|
||||
})
|
||||
|
||||
obj = libraries.stripe.Account.construct_from({
|
||||
obj = libraries.stripe3.Account.construct_from({
|
||||
'id': 'acct_reject'
|
||||
}, 'mykey')
|
||||
|
||||
@@ -127,7 +127,7 @@ class AccountTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_verify_additional_owner(self):
|
||||
acct = libraries.stripe.Account.construct_from({
|
||||
acct = libraries.stripe3.Account.construct_from({
|
||||
'id': 'acct_update',
|
||||
'additional_owners': [{
|
||||
'first_name': 'Alice',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import libraries.stripe
|
||||
from libraries.stripe.test.helper import (
|
||||
import libraries.stripe3
|
||||
from libraries.stripe3.test.helper import (
|
||||
StripeApiTestCase, MyResource, MySingleton
|
||||
)
|
||||
|
||||
@@ -53,14 +53,14 @@ class APIResourceTests(StripeApiTestCase):
|
||||
]
|
||||
}
|
||||
|
||||
converted = libraries.stripe.resource.convert_to_stripe_object(
|
||||
converted = libraries.stripe3.resource.convert_to_stripe_object(
|
||||
sample, 'akey', None)
|
||||
|
||||
# Types
|
||||
self.assertTrue(isinstance(converted, libraries.stripe.resource.StripeObject))
|
||||
self.assertTrue(isinstance(converted.adict, libraries.stripe.Charge))
|
||||
self.assertTrue(isinstance(converted, libraries.stripe3.resource.StripeObject))
|
||||
self.assertTrue(isinstance(converted.adict, libraries.stripe3.Charge))
|
||||
self.assertEqual(1, len(converted.alist))
|
||||
self.assertTrue(isinstance(converted.alist[0], libraries.stripe.Customer))
|
||||
self.assertTrue(isinstance(converted.alist[0], libraries.stripe3.Customer))
|
||||
|
||||
# Values
|
||||
self.assertEqual('bar', converted.foo)
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import libraries.stripe
|
||||
from libraries.stripe.test.helper import StripeResourceTest
|
||||
import libraries.stripe3
|
||||
from libraries.stripe3.test.helper import StripeResourceTest
|
||||
|
||||
|
||||
class ApplicationFeeTest(StripeResourceTest):
|
||||
|
||||
def test_list_application_fees(self):
|
||||
libraries.stripe.ApplicationFee.list()
|
||||
libraries.stripe3.ApplicationFee.list()
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'get',
|
||||
'/v1/application_fees',
|
||||
@@ -16,7 +16,7 @@ class ApplicationFeeTest(StripeResourceTest):
|
||||
class ApplicationFeeRefundTest(StripeResourceTest):
|
||||
|
||||
def test_fetch_refund(self):
|
||||
fee = libraries.stripe.ApplicationFee.construct_from({
|
||||
fee = libraries.stripe3.ApplicationFee.construct_from({
|
||||
'id': 'fee_get_refund',
|
||||
'refunds': {
|
||||
'object': 'list',
|
||||
@@ -34,7 +34,7 @@ class ApplicationFeeRefundTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_list_refunds(self):
|
||||
fee = libraries.stripe.ApplicationFee.construct_from({
|
||||
fee = libraries.stripe3.ApplicationFee.construct_from({
|
||||
'id': 'fee_get_refund',
|
||||
'refunds': {
|
||||
'object': 'list',
|
||||
@@ -53,11 +53,11 @@ class ApplicationFeeRefundTest(StripeResourceTest):
|
||||
|
||||
def test_update_refund(self):
|
||||
def side_effect(*args):
|
||||
raise libraries.stripe.InvalidRequestError('invalid', 'foo')
|
||||
raise libraries.stripe3.InvalidRequestError('invalid', 'foo')
|
||||
|
||||
self.requestor_mock.request.side_effect = side_effect
|
||||
|
||||
refund = libraries.stripe.resource.ApplicationFeeRefund.construct_from({
|
||||
refund = libraries.stripe3.resource.ApplicationFeeRefund.construct_from({
|
||||
'id': "ref_update",
|
||||
'fee': "fee_update",
|
||||
'metadata': {},
|
||||
@@ -67,7 +67,7 @@ class ApplicationFeeRefundTest(StripeResourceTest):
|
||||
|
||||
try:
|
||||
refund.save()
|
||||
except libraries.stripe.InvalidRequestError:
|
||||
except libraries.stripe3.InvalidRequestError:
|
||||
pass
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
@@ -98,7 +98,7 @@ class ApplicationFeeRefundTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_modify_refund(self):
|
||||
libraries.stripe.resource.ApplicationFeeRefund.modify("fee_update", "ref_update",
|
||||
libraries.stripe3.resource.ApplicationFeeRefund.modify("fee_update", "ref_update",
|
||||
metadata={'key': 'foo'},
|
||||
api_key='api_key')
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import libraries.stripe
|
||||
from libraries.stripe.test.helper import StripeResourceTest
|
||||
import libraries.stripe3
|
||||
from libraries.stripe3.test.helper import StripeResourceTest
|
||||
|
||||
|
||||
class BalanceTest(StripeResourceTest):
|
||||
|
||||
def test_retrieve_balance(self):
|
||||
libraries.stripe.Balance.retrieve()
|
||||
libraries.stripe3.Balance.retrieve()
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'get',
|
||||
@@ -18,7 +18,7 @@ class BalanceTest(StripeResourceTest):
|
||||
class BalanceTransactionTest(StripeResourceTest):
|
||||
|
||||
def test_list_balance_transactions(self):
|
||||
libraries.stripe.BalanceTransaction.list()
|
||||
libraries.stripe3.BalanceTransaction.list()
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'get',
|
||||
'/v1/balance/history',
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import libraries.stripe
|
||||
from libraries.stripe.test.helper import StripeResourceTest
|
||||
import libraries.stripe3
|
||||
from libraries.stripe3.test.helper import StripeResourceTest
|
||||
|
||||
|
||||
class BitcoinReceiverTest(StripeResourceTest):
|
||||
|
||||
def test_retrieve_resource(self):
|
||||
libraries.stripe.BitcoinReceiver.retrieve("btcrcv_test_receiver")
|
||||
libraries.stripe3.BitcoinReceiver.retrieve("btcrcv_test_receiver")
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'get',
|
||||
'/v1/bitcoin/receivers/btcrcv_test_receiver',
|
||||
@@ -14,7 +14,7 @@ class BitcoinReceiverTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_list_receivers(self):
|
||||
libraries.stripe.BitcoinReceiver.list()
|
||||
libraries.stripe3.BitcoinReceiver.list()
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'get',
|
||||
'/v1/bitcoin/receivers',
|
||||
@@ -22,7 +22,7 @@ class BitcoinReceiverTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_create_receiver(self):
|
||||
libraries.stripe.BitcoinReceiver.create(amount=100, description="some details",
|
||||
libraries.stripe3.BitcoinReceiver.create(amount=100, description="some details",
|
||||
currency="usd",
|
||||
email="do+fill_now@stripe.com")
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
@@ -40,7 +40,7 @@ class BitcoinReceiverTest(StripeResourceTest):
|
||||
def test_update_receiver_without_customer(self):
|
||||
params = {'id': 'receiver', 'amount': 100,
|
||||
'description': "some details", 'currency': "usd"}
|
||||
r = libraries.stripe.BitcoinReceiver.construct_from(params, 'api_key')
|
||||
r = libraries.stripe3.BitcoinReceiver.construct_from(params, 'api_key')
|
||||
r.description = "some other details"
|
||||
r.save()
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
@@ -56,7 +56,7 @@ class BitcoinReceiverTest(StripeResourceTest):
|
||||
params = {'id': 'receiver', 'amount': 100,
|
||||
'description': "some details", 'currency': "usd",
|
||||
'customer': "cust"}
|
||||
r = libraries.stripe.BitcoinReceiver.construct_from(params, 'api_key')
|
||||
r = libraries.stripe3.BitcoinReceiver.construct_from(params, 'api_key')
|
||||
r.description = "some other details"
|
||||
r.save()
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
@@ -71,7 +71,7 @@ class BitcoinReceiverTest(StripeResourceTest):
|
||||
def test_delete_receiver_without_customer(self):
|
||||
params = {'id': 'receiver', 'amount': 100,
|
||||
'description': "some details", 'currency': "usd"}
|
||||
r = libraries.stripe.BitcoinReceiver.construct_from(params, 'api_key')
|
||||
r = libraries.stripe3.BitcoinReceiver.construct_from(params, 'api_key')
|
||||
r.delete()
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'delete',
|
||||
@@ -84,7 +84,7 @@ class BitcoinReceiverTest(StripeResourceTest):
|
||||
params = {'id': 'receiver', 'amount': 100,
|
||||
'description': "some details", 'currency': "usd",
|
||||
'customer': "cust"}
|
||||
r = libraries.stripe.BitcoinReceiver.construct_from(params, 'api_key')
|
||||
r = libraries.stripe3.BitcoinReceiver.construct_from(params, 'api_key')
|
||||
r.delete()
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'delete',
|
||||
@@ -94,7 +94,7 @@ class BitcoinReceiverTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_list_transactions(self):
|
||||
receiver = libraries.stripe.BitcoinReceiver.construct_from({
|
||||
receiver = libraries.stripe3.BitcoinReceiver.construct_from({
|
||||
'id': 'btcrcv_foo',
|
||||
'transactions': {
|
||||
'object': 'list',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import libraries.stripe
|
||||
from libraries.stripe.test.helper import (
|
||||
import libraries.stripe3
|
||||
from libraries.stripe3.test.helper import (
|
||||
StripeResourceTest, NOW, DUMMY_CHARGE
|
||||
)
|
||||
|
||||
@@ -7,7 +7,7 @@ from libraries.stripe.test.helper import (
|
||||
class ChargeTest(StripeResourceTest):
|
||||
|
||||
def test_charge_list(self):
|
||||
libraries.stripe.Charge.list(created={'lt': NOW})
|
||||
libraries.stripe3.Charge.list(created={'lt': NOW})
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'get',
|
||||
@@ -18,7 +18,7 @@ class ChargeTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_charge_create(self):
|
||||
libraries.stripe.Charge.create(idempotency_key='foo', **DUMMY_CHARGE)
|
||||
libraries.stripe3.Charge.create(idempotency_key='foo', **DUMMY_CHARGE)
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'post',
|
||||
@@ -28,7 +28,7 @@ class ChargeTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_charge_retrieve(self):
|
||||
libraries.stripe.Charge.retrieve('ch_test_id')
|
||||
libraries.stripe3.Charge.retrieve('ch_test_id')
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'get',
|
||||
@@ -38,7 +38,7 @@ class ChargeTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_charge_modify(self):
|
||||
libraries.stripe.Charge.modify('ch_test_id', refund=True)
|
||||
libraries.stripe3.Charge.modify('ch_test_id', refund=True)
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'post',
|
||||
@@ -50,7 +50,7 @@ class ChargeTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_charge_update_dispute(self):
|
||||
charge = libraries.stripe.Charge(id='ch_update_id')
|
||||
charge = libraries.stripe3.Charge(id='ch_update_id')
|
||||
charge.update_dispute(idempotency_key='foo')
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
@@ -61,7 +61,7 @@ class ChargeTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_charge_close_dispute(self):
|
||||
charge = libraries.stripe.Charge(id='ch_update_id')
|
||||
charge = libraries.stripe3.Charge(id='ch_update_id')
|
||||
charge.close_dispute(idempotency_key='foo')
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
@@ -72,7 +72,7 @@ class ChargeTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_mark_as_fraudulent(self):
|
||||
charge = libraries.stripe.Charge(id='ch_update_id')
|
||||
charge = libraries.stripe3.Charge(id='ch_update_id')
|
||||
charge.mark_as_fraudulent(idempotency_key='foo')
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
@@ -85,7 +85,7 @@ class ChargeTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_mark_as_safe(self):
|
||||
charge = libraries.stripe.Charge(id='ch_update_id')
|
||||
charge = libraries.stripe3.Charge(id='ch_update_id')
|
||||
charge.mark_as_safe(idempotency_key='foo')
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
@@ -98,7 +98,7 @@ class ChargeTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_create_with_source_param(self):
|
||||
libraries.stripe.Charge.create(amount=100, currency='usd',
|
||||
libraries.stripe3.Charge.create(amount=100, currency='usd',
|
||||
source='btcrcv_test_receiver')
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import libraries.stripe
|
||||
from libraries.stripe.test.helper import StripeResourceTest
|
||||
import libraries.stripe3
|
||||
from libraries.stripe3.test.helper import StripeResourceTest
|
||||
|
||||
|
||||
class CountrySpecTest(StripeResourceTest):
|
||||
|
||||
def test_country_spec_list(self):
|
||||
libraries.stripe.CountrySpec.list()
|
||||
libraries.stripe3.CountrySpec.list()
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'get',
|
||||
'/v1/country_specs',
|
||||
@@ -13,7 +13,7 @@ class CountrySpecTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_country_spec_retrieve(self):
|
||||
libraries.stripe.CountrySpec.retrieve('US')
|
||||
libraries.stripe3.CountrySpec.retrieve('US')
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'get',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import libraries.stripe
|
||||
from libraries.stripe.test.helper import (
|
||||
import libraries.stripe3
|
||||
from libraries.stripe3.test.helper import (
|
||||
StripeResourceTest, DUMMY_COUPON
|
||||
)
|
||||
|
||||
@@ -7,7 +7,7 @@ from libraries.stripe.test.helper import (
|
||||
class CouponTest(StripeResourceTest):
|
||||
|
||||
def test_create_coupon(self):
|
||||
libraries.stripe.Coupon.create(**DUMMY_COUPON)
|
||||
libraries.stripe3.Coupon.create(**DUMMY_COUPON)
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'post',
|
||||
'/v1/coupons',
|
||||
@@ -16,7 +16,7 @@ class CouponTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_update_coupon(self):
|
||||
coup = libraries.stripe.Coupon.construct_from({
|
||||
coup = libraries.stripe3.Coupon.construct_from({
|
||||
'id': 'cu_update',
|
||||
'metadata': {},
|
||||
}, 'api_key')
|
||||
@@ -35,7 +35,7 @@ class CouponTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_delete_coupon(self):
|
||||
c = libraries.stripe.Coupon(id='cu_delete')
|
||||
c = libraries.stripe3.Coupon(id='cu_delete')
|
||||
c.delete()
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
@@ -46,7 +46,7 @@ class CouponTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_detach_coupon(self):
|
||||
customer = libraries.stripe.Customer(id="cus_delete_discount")
|
||||
customer = libraries.stripe3.Customer(id="cus_delete_discount")
|
||||
customer.delete_discount()
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import libraries.stripe
|
||||
from libraries.stripe.test.helper import (
|
||||
import libraries.stripe3
|
||||
from libraries.stripe3.test.helper import (
|
||||
StripeApiTestCase, MyCreatable
|
||||
)
|
||||
|
||||
@@ -17,7 +17,7 @@ class CreateableAPIResourceTests(StripeApiTestCase):
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'post', '/v1/mycreatables', {}, None)
|
||||
|
||||
self.assertTrue(isinstance(res, libraries.stripe.Charge))
|
||||
self.assertTrue(isinstance(res, libraries.stripe3.Charge))
|
||||
self.assertEqual('bar', res.foo)
|
||||
|
||||
def test_idempotent_create(self):
|
||||
@@ -31,5 +31,5 @@ class CreateableAPIResourceTests(StripeApiTestCase):
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'post', '/v1/mycreatables', {}, {'Idempotency-Key': 'foo'})
|
||||
|
||||
self.assertTrue(isinstance(res, libraries.stripe.Charge))
|
||||
self.assertTrue(isinstance(res, libraries.stripe3.Charge))
|
||||
self.assertEqual('bar', res.foo)
|
||||
|
||||
@@ -2,8 +2,8 @@ import datetime
|
||||
import time
|
||||
import warnings
|
||||
|
||||
import libraries.stripe
|
||||
from libraries.stripe.test.helper import (
|
||||
import libraries.stripe3
|
||||
from libraries.stripe3.test.helper import (
|
||||
StripeResourceTest, DUMMY_CARD, DUMMY_PLAN
|
||||
)
|
||||
|
||||
@@ -11,7 +11,7 @@ from libraries.stripe.test.helper import (
|
||||
class CustomerTest(StripeResourceTest):
|
||||
|
||||
def test_list_customers(self):
|
||||
libraries.stripe.Customer.list()
|
||||
libraries.stripe3.Customer.list()
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'get',
|
||||
'/v1/customers',
|
||||
@@ -19,7 +19,7 @@ class CustomerTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_create_customer(self):
|
||||
libraries.stripe.Customer.create(description="foo bar", card=DUMMY_CARD,
|
||||
libraries.stripe3.Customer.create(description="foo bar", card=DUMMY_CARD,
|
||||
coupon='cu_discount', idempotency_key='foo')
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'post',
|
||||
@@ -33,7 +33,7 @@ class CustomerTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_unset_description(self):
|
||||
customer = libraries.stripe.Customer(id="cus_unset_desc")
|
||||
customer = libraries.stripe3.Customer(id="cus_unset_desc")
|
||||
customer.description = "Hey"
|
||||
customer.save(idempotency_key='foo')
|
||||
|
||||
@@ -47,7 +47,7 @@ class CustomerTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_del_coupon(self):
|
||||
customer = libraries.stripe.Customer(id="cus_unset_desc")
|
||||
customer = libraries.stripe3.Customer(id="cus_unset_desc")
|
||||
customer.description = "bar"
|
||||
customer.coupon = "foo"
|
||||
del customer.coupon
|
||||
@@ -63,11 +63,11 @@ class CustomerTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_cannot_set_empty_string(self):
|
||||
customer = libraries.stripe.Customer()
|
||||
customer = libraries.stripe3.Customer()
|
||||
self.assertRaises(ValueError, setattr, customer, "description", "")
|
||||
|
||||
def test_customer_add_card(self):
|
||||
customer = libraries.stripe.Customer.construct_from({
|
||||
customer = libraries.stripe3.Customer.construct_from({
|
||||
'id': 'cus_add_card',
|
||||
'sources': {
|
||||
'object': 'list',
|
||||
@@ -86,7 +86,7 @@ class CustomerTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_customer_add_source(self):
|
||||
customer = libraries.stripe.Customer.construct_from({
|
||||
customer = libraries.stripe3.Customer.construct_from({
|
||||
'id': 'cus_add_source',
|
||||
'sources': {
|
||||
'object': 'list',
|
||||
@@ -105,7 +105,7 @@ class CustomerTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_customer_update_card(self):
|
||||
card = libraries.stripe.Card.construct_from({
|
||||
card = libraries.stripe3.Card.construct_from({
|
||||
'customer': 'cus_update_card',
|
||||
'id': 'ca_update_card',
|
||||
}, 'api_key')
|
||||
@@ -122,7 +122,7 @@ class CustomerTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_customer_update_source(self):
|
||||
source = libraries.stripe.BitcoinReceiver.construct_from({
|
||||
source = libraries.stripe3.BitcoinReceiver.construct_from({
|
||||
'customer': 'cus_update_source',
|
||||
'id': 'btcrcv_update_source',
|
||||
}, 'api_key')
|
||||
@@ -139,7 +139,7 @@ class CustomerTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_customer_update_alipay_account(self):
|
||||
aa = libraries.stripe.AlipayAccount.construct_from({
|
||||
aa = libraries.stripe3.AlipayAccount.construct_from({
|
||||
'customer': 'cus_update_alipay',
|
||||
'id': 'ali_update',
|
||||
}, 'api_key')
|
||||
@@ -156,7 +156,7 @@ class CustomerTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_customer_delete_card(self):
|
||||
card = libraries.stripe.Card.construct_from({
|
||||
card = libraries.stripe3.Card.construct_from({
|
||||
'customer': 'cus_delete_card',
|
||||
'id': 'ca_delete_card',
|
||||
}, 'api_key')
|
||||
@@ -170,7 +170,7 @@ class CustomerTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_customer_delete_source(self):
|
||||
source = libraries.stripe.BitcoinReceiver.construct_from({
|
||||
source = libraries.stripe3.BitcoinReceiver.construct_from({
|
||||
'customer': 'cus_delete_source',
|
||||
'id': 'btcrcv_delete_source',
|
||||
}, 'api_key')
|
||||
@@ -184,7 +184,7 @@ class CustomerTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_customer_delete_alipay_account(self):
|
||||
aa = libraries.stripe.AlipayAccount.construct_from({
|
||||
aa = libraries.stripe3.AlipayAccount.construct_from({
|
||||
'customer': 'cus_delete_alipay',
|
||||
'id': 'ali_delete',
|
||||
}, 'api_key')
|
||||
@@ -198,7 +198,7 @@ class CustomerTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_customer_delete_bank_account(self):
|
||||
source = libraries.stripe.BankAccount.construct_from({
|
||||
source = libraries.stripe3.BankAccount.construct_from({
|
||||
'customer': 'cus_delete_source',
|
||||
'id': 'ba_delete_source',
|
||||
}, 'api_key')
|
||||
@@ -212,7 +212,7 @@ class CustomerTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_customer_verify_bank_account(self):
|
||||
source = libraries.stripe.BankAccount.construct_from({
|
||||
source = libraries.stripe3.BankAccount.construct_from({
|
||||
'customer': 'cus_verify_source',
|
||||
'id': 'ba_verify_source',
|
||||
}, 'api_key')
|
||||
@@ -229,7 +229,7 @@ class CustomerTest(StripeResourceTest):
|
||||
class CustomerPlanTest(StripeResourceTest):
|
||||
|
||||
def test_create_customer(self):
|
||||
libraries.stripe.Customer.create(plan=DUMMY_PLAN['id'], card=DUMMY_CARD)
|
||||
libraries.stripe3.Customer.create(plan=DUMMY_PLAN['id'], card=DUMMY_CARD)
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'post',
|
||||
@@ -243,7 +243,7 @@ class CustomerPlanTest(StripeResourceTest):
|
||||
|
||||
def test_legacy_update_subscription(self):
|
||||
with warnings.catch_warnings(record=True) as w:
|
||||
customer = libraries.stripe.Customer(id="cus_legacy_sub_update")
|
||||
customer = libraries.stripe3.Customer(id="cus_legacy_sub_update")
|
||||
customer.update_subscription(idempotency_key='foo',
|
||||
plan=DUMMY_PLAN['id'])
|
||||
|
||||
@@ -261,7 +261,7 @@ class CustomerPlanTest(StripeResourceTest):
|
||||
|
||||
def test_legacy_delete_subscription(self):
|
||||
with warnings.catch_warnings(record=True) as w:
|
||||
customer = libraries.stripe.Customer(id="cus_legacy_sub_delete")
|
||||
customer = libraries.stripe3.Customer(id="cus_legacy_sub_delete")
|
||||
customer.cancel_subscription()
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
@@ -275,7 +275,7 @@ class CustomerPlanTest(StripeResourceTest):
|
||||
self.assertTrue(issubclass(w[-1].category, DeprecationWarning))
|
||||
|
||||
def test_list_customer_subscriptions(self):
|
||||
customer = libraries.stripe.Customer.construct_from({
|
||||
customer = libraries.stripe3.Customer.construct_from({
|
||||
'id': 'cus_foo',
|
||||
'subscriptions': {
|
||||
'object': 'list',
|
||||
@@ -293,7 +293,7 @@ class CustomerPlanTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_create_customer_subscription(self):
|
||||
customer = libraries.stripe.Customer.construct_from({
|
||||
customer = libraries.stripe3.Customer.construct_from({
|
||||
'id': 'cus_sub_create',
|
||||
'subscriptions': {
|
||||
'object': 'list',
|
||||
@@ -314,7 +314,7 @@ class CustomerPlanTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_retrieve_customer_subscription(self):
|
||||
customer = libraries.stripe.Customer.construct_from({
|
||||
customer = libraries.stripe3.Customer.construct_from({
|
||||
'id': 'cus_foo',
|
||||
'subscriptions': {
|
||||
'object': 'list',
|
||||
@@ -332,7 +332,7 @@ class CustomerPlanTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_update_customer_subscription(self):
|
||||
subscription = libraries.stripe.Subscription.construct_from({
|
||||
subscription = libraries.stripe3.Subscription.construct_from({
|
||||
'id': "sub_update",
|
||||
'customer': "cus_foo",
|
||||
}, 'api_key')
|
||||
@@ -355,7 +355,7 @@ class CustomerPlanTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_delete_customer_subscription(self):
|
||||
subscription = libraries.stripe.Subscription.construct_from({
|
||||
subscription = libraries.stripe3.Subscription.construct_from({
|
||||
'id': "sub_delete",
|
||||
'customer': "cus_foo",
|
||||
}, 'api_key')
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from libraries.stripe.test.helper import (
|
||||
from libraries.stripe3.test.helper import (
|
||||
StripeApiTestCase, MyDeletable
|
||||
)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import libraries.stripe
|
||||
from libraries.stripe.test.helper import (
|
||||
import libraries.stripe3
|
||||
from libraries.stripe3.test.helper import (
|
||||
StripeResourceTest, DUMMY_DISPUTE, NOW
|
||||
)
|
||||
|
||||
@@ -7,7 +7,7 @@ from libraries.stripe.test.helper import (
|
||||
class DisputeTest(StripeResourceTest):
|
||||
|
||||
def test_list_all_disputes(self):
|
||||
libraries.stripe.Dispute.list(created={'lt': NOW})
|
||||
libraries.stripe3.Dispute.list(created={'lt': NOW})
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'get',
|
||||
@@ -18,7 +18,7 @@ class DisputeTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_create_dispute(self):
|
||||
libraries.stripe.Dispute.create(idempotency_key='foo', **DUMMY_DISPUTE)
|
||||
libraries.stripe3.Dispute.create(idempotency_key='foo', **DUMMY_DISPUTE)
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'post',
|
||||
@@ -28,7 +28,7 @@ class DisputeTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_retrieve_dispute(self):
|
||||
libraries.stripe.Dispute.retrieve('dp_test_id')
|
||||
libraries.stripe3.Dispute.retrieve('dp_test_id')
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'get',
|
||||
@@ -38,7 +38,7 @@ class DisputeTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_update_dispute(self):
|
||||
dispute = libraries.stripe.Dispute.construct_from({
|
||||
dispute = libraries.stripe3.Dispute.construct_from({
|
||||
'id': 'dp_update_id',
|
||||
'evidence': {
|
||||
'product_description': 'description',
|
||||
@@ -59,7 +59,7 @@ class DisputeTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_close_dispute(self):
|
||||
dispute = libraries.stripe.Dispute(id='dp_close_id')
|
||||
dispute = libraries.stripe3.Dispute(id='dp_close_id')
|
||||
dispute.close(idempotency_key='foo')
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import tempfile
|
||||
|
||||
import libraries.stripe
|
||||
from libraries.stripe.test.helper import StripeResourceTest
|
||||
import libraries.stripe3
|
||||
from libraries.stripe3.test.helper import StripeResourceTest
|
||||
|
||||
|
||||
class FileUploadTest(StripeResourceTest):
|
||||
|
||||
def test_create_file_upload(self):
|
||||
test_file = tempfile.TemporaryFile()
|
||||
libraries.stripe.FileUpload.create(
|
||||
libraries.stripe3.FileUpload.create(
|
||||
purpose='dispute_evidence',
|
||||
file=test_file
|
||||
)
|
||||
@@ -23,7 +23,7 @@ class FileUploadTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_fetch_file_upload(self):
|
||||
libraries.stripe.FileUpload.retrieve("fil_foo")
|
||||
libraries.stripe3.FileUpload.retrieve("fil_foo")
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'get',
|
||||
'/v1/files/fil_foo',
|
||||
@@ -32,7 +32,7 @@ class FileUploadTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_list_file_uploads(self):
|
||||
libraries.stripe.FileUpload.list()
|
||||
libraries.stripe3.FileUpload.list()
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'get',
|
||||
'/v1/files',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import libraries.stripe
|
||||
from libraries.stripe.test.helper import (
|
||||
import libraries.stripe3
|
||||
from libraries.stripe3.test.helper import (
|
||||
StripeResourceTest, DUMMY_INVOICE_ITEM
|
||||
)
|
||||
|
||||
@@ -7,7 +7,7 @@ from libraries.stripe.test.helper import (
|
||||
class InvoiceTest(StripeResourceTest):
|
||||
|
||||
def test_add_invoice_item(self):
|
||||
customer = libraries.stripe.Customer(id="cus_invoice_items")
|
||||
customer = libraries.stripe3.Customer(id="cus_invoice_items")
|
||||
customer.add_invoice_item(**DUMMY_INVOICE_ITEM)
|
||||
|
||||
expected = DUMMY_INVOICE_ITEM.copy()
|
||||
@@ -21,7 +21,7 @@ class InvoiceTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_retrieve_invoice_items(self):
|
||||
customer = libraries.stripe.Customer(id="cus_get_invoice_items")
|
||||
customer = libraries.stripe3.Customer(id="cus_get_invoice_items")
|
||||
customer.invoice_items()
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
@@ -31,8 +31,8 @@ class InvoiceTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_invoice_create(self):
|
||||
customer = libraries.stripe.Customer(id="cus_invoice")
|
||||
libraries.stripe.Invoice.create(customer=customer.id)
|
||||
customer = libraries.stripe3.Customer(id="cus_invoice")
|
||||
libraries.stripe3.Invoice.create(customer=customer.id)
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'post',
|
||||
@@ -44,7 +44,7 @@ class InvoiceTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_retrieve_customer_invoices(self):
|
||||
customer = libraries.stripe.Customer(id="cus_invoice_items")
|
||||
customer = libraries.stripe3.Customer(id="cus_invoice_items")
|
||||
customer.invoices()
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
@@ -56,7 +56,7 @@ class InvoiceTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_pay_invoice(self):
|
||||
invoice = libraries.stripe.Invoice(id="ii_pay")
|
||||
invoice = libraries.stripe3.Invoice(id="ii_pay")
|
||||
invoice.pay()
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
@@ -67,7 +67,7 @@ class InvoiceTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_upcoming_invoice(self):
|
||||
libraries.stripe.Invoice.upcoming()
|
||||
libraries.stripe3.Invoice.upcoming()
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'get',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import libraries.stripe
|
||||
from libraries.stripe.test.helper import StripeApiTestCase
|
||||
import libraries.stripe3
|
||||
from libraries.stripe3.test.helper import StripeApiTestCase
|
||||
|
||||
|
||||
class ListObjectTests(StripeApiTestCase):
|
||||
@@ -7,7 +7,7 @@ class ListObjectTests(StripeApiTestCase):
|
||||
def setUp(self):
|
||||
super(ListObjectTests, self).setUp()
|
||||
|
||||
self.lo = libraries.stripe.resource.ListObject.construct_from({
|
||||
self.lo = libraries.stripe3.resource.ListObject.construct_from({
|
||||
'id': 'me',
|
||||
'url': '/my/path',
|
||||
'data': ['foo'],
|
||||
@@ -19,7 +19,7 @@ class ListObjectTests(StripeApiTestCase):
|
||||
}])
|
||||
|
||||
def assertResponse(self, res):
|
||||
self.assertTrue(isinstance(res[0], libraries.stripe.Charge))
|
||||
self.assertTrue(isinstance(res[0], libraries.stripe3.Charge))
|
||||
self.assertEqual('bar', res[0].foo)
|
||||
|
||||
def test_for_loop(self):
|
||||
@@ -67,7 +67,7 @@ class AutoPagingTests(StripeApiTestCase):
|
||||
}
|
||||
|
||||
def test_iter_one_page(self):
|
||||
lo = libraries.stripe.resource.ListObject.construct_from(
|
||||
lo = libraries.stripe3.resource.ListObject.construct_from(
|
||||
self.pageable_model_response(['pm_123', 'pm_124'], False),
|
||||
'mykey'
|
||||
)
|
||||
@@ -79,7 +79,7 @@ class AutoPagingTests(StripeApiTestCase):
|
||||
self.assertEqual(['pm_123', 'pm_124'], seen)
|
||||
|
||||
def test_iter_two_pages(self):
|
||||
lo = libraries.stripe.resource.ListObject.construct_from(
|
||||
lo = libraries.stripe3.resource.ListObject.construct_from(
|
||||
self.pageable_model_response(['pm_123', 'pm_124'], True),
|
||||
'mykey'
|
||||
)
|
||||
@@ -111,7 +111,7 @@ class AutoPagingTests(StripeApiTestCase):
|
||||
'has_more': False,
|
||||
})
|
||||
|
||||
seen = [item['id'] for item in libraries.stripe.Charge.auto_paging_iter(
|
||||
seen = [item['id'] for item in libraries.stripe3.Charge.auto_paging_iter(
|
||||
limit=25,
|
||||
foo='bar'
|
||||
)]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import libraries.stripe
|
||||
from libraries.stripe.test.helper import (
|
||||
import libraries.stripe3
|
||||
from libraries.stripe3.test.helper import (
|
||||
StripeApiTestCase, MyListable
|
||||
)
|
||||
|
||||
@@ -29,7 +29,7 @@ class ListableAPIResourceTests(StripeApiTestCase):
|
||||
'get', '/v1/mylistables', {})
|
||||
|
||||
self.assertEqual(2, len(res.data))
|
||||
self.assertTrue(all(isinstance(obj, libraries.stripe.Charge)
|
||||
self.assertTrue(all(isinstance(obj, libraries.stripe3.Charge)
|
||||
for obj in res.data))
|
||||
self.assertEqual('jose', res.data[0].name)
|
||||
self.assertEqual('curly', res.data[1].name)
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import libraries.stripe
|
||||
from libraries.stripe.test.helper import StripeResourceTest
|
||||
import libraries.stripe3
|
||||
from libraries.stripe3.test.helper import StripeResourceTest
|
||||
|
||||
|
||||
class MetadataTest(StripeResourceTest):
|
||||
|
||||
def test_noop_metadata(self):
|
||||
charge = libraries.stripe.Charge(id='ch_foo')
|
||||
charge = libraries.stripe3.Charge(id='ch_foo')
|
||||
charge.description = 'test'
|
||||
charge.save()
|
||||
|
||||
@@ -19,7 +19,7 @@ class MetadataTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_unset_metadata(self):
|
||||
charge = libraries.stripe.Charge(id='ch_foo')
|
||||
charge = libraries.stripe3.Charge(id='ch_foo')
|
||||
charge.metadata = {}
|
||||
charge.save()
|
||||
|
||||
@@ -33,7 +33,7 @@ class MetadataTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_whole_update(self):
|
||||
charge = libraries.stripe.Charge(id='ch_foo')
|
||||
charge = libraries.stripe3.Charge(id='ch_foo')
|
||||
charge.metadata = {'whole': 'update'}
|
||||
charge.save()
|
||||
|
||||
@@ -47,7 +47,7 @@ class MetadataTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_individual_delete(self):
|
||||
charge = libraries.stripe.Charge(id='ch_foo')
|
||||
charge = libraries.stripe3.Charge(id='ch_foo')
|
||||
charge.metadata = {'whole': None}
|
||||
charge.save()
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import libraries.stripe
|
||||
from libraries.stripe.test.helper import (
|
||||
import libraries.stripe3
|
||||
from libraries.stripe3.test.helper import (
|
||||
StripeResourceTest, DUMMY_PLAN
|
||||
)
|
||||
|
||||
@@ -7,7 +7,7 @@ from libraries.stripe.test.helper import (
|
||||
class PlanTest(StripeResourceTest):
|
||||
|
||||
def test_create_plan(self):
|
||||
libraries.stripe.Plan.create(**DUMMY_PLAN)
|
||||
libraries.stripe3.Plan.create(**DUMMY_PLAN)
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'post',
|
||||
@@ -17,7 +17,7 @@ class PlanTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_delete_plan(self):
|
||||
p = libraries.stripe.Plan(id="pl_delete")
|
||||
p = libraries.stripe3.Plan(id="pl_delete")
|
||||
p.delete()
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
@@ -28,7 +28,7 @@ class PlanTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_update_plan(self):
|
||||
p = libraries.stripe.Plan(id="pl_update")
|
||||
p = libraries.stripe3.Plan(id="pl_update")
|
||||
p.name = "Plan Name"
|
||||
p.save()
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import libraries.stripe
|
||||
from libraries.stripe.test.helper import (
|
||||
import libraries.stripe3
|
||||
from libraries.stripe3.test.helper import (
|
||||
StripeResourceTest, DUMMY_CARD
|
||||
)
|
||||
|
||||
@@ -7,7 +7,7 @@ from libraries.stripe.test.helper import (
|
||||
class RecipientTest(StripeResourceTest):
|
||||
|
||||
def test_list_recipients(self):
|
||||
libraries.stripe.Recipient.list()
|
||||
libraries.stripe3.Recipient.list()
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'get',
|
||||
'/v1/recipients',
|
||||
@@ -15,7 +15,7 @@ class RecipientTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_recipient_transfers(self):
|
||||
recipient = libraries.stripe.Recipient(id='rp_transfer')
|
||||
recipient = libraries.stripe3.Recipient(id='rp_transfer')
|
||||
recipient.transfers()
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
@@ -25,7 +25,7 @@ class RecipientTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_recipient_add_card(self):
|
||||
recipient = libraries.stripe.Recipient.construct_from({
|
||||
recipient = libraries.stripe3.Recipient.construct_from({
|
||||
'id': 'rp_add_card',
|
||||
'sources': {
|
||||
'object': 'list',
|
||||
@@ -44,7 +44,7 @@ class RecipientTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_recipient_update_card(self):
|
||||
card = libraries.stripe.Card.construct_from({
|
||||
card = libraries.stripe3.Card.construct_from({
|
||||
'recipient': 'rp_update_card',
|
||||
'id': 'ca_update_card',
|
||||
}, 'api_key')
|
||||
@@ -61,7 +61,7 @@ class RecipientTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_recipient_delete_card(self):
|
||||
card = libraries.stripe.Card.construct_from({
|
||||
card = libraries.stripe3.Card.construct_from({
|
||||
'recipient': 'rp_delete_card',
|
||||
'id': 'ca_delete_card',
|
||||
}, 'api_key')
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import libraries.stripe
|
||||
from libraries.stripe.test.helper import StripeResourceTest
|
||||
import libraries.stripe3
|
||||
from libraries.stripe3.test.helper import StripeResourceTest
|
||||
|
||||
|
||||
class RefundTest(StripeResourceTest):
|
||||
|
||||
def test_create_refund(self):
|
||||
libraries.stripe.Refund.create(charge='ch_foo')
|
||||
libraries.stripe3.Refund.create(charge='ch_foo')
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'post',
|
||||
@@ -15,7 +15,7 @@ class RefundTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_fetch_refund(self):
|
||||
libraries.stripe.Refund.retrieve('re_foo')
|
||||
libraries.stripe3.Refund.retrieve('re_foo')
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'get',
|
||||
@@ -25,7 +25,7 @@ class RefundTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_list_refunds(self):
|
||||
libraries.stripe.Refund.list(limit=3, charge='ch_foo')
|
||||
libraries.stripe3.Refund.list(limit=3, charge='ch_foo')
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'get',
|
||||
@@ -34,7 +34,7 @@ class RefundTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_update_refund(self):
|
||||
refund = libraries.stripe.resource.Refund.construct_from({
|
||||
refund = libraries.stripe3.resource.Refund.construct_from({
|
||||
'id': "ref_update",
|
||||
'charge': "ch_update",
|
||||
'metadata': {},
|
||||
@@ -57,7 +57,7 @@ class RefundTest(StripeResourceTest):
|
||||
class ChargeRefundTest(StripeResourceTest):
|
||||
|
||||
def test_create_refund(self):
|
||||
charge = libraries.stripe.Charge.construct_from({
|
||||
charge = libraries.stripe3.Charge.construct_from({
|
||||
'id': 'ch_foo',
|
||||
'refunds': {
|
||||
'object': 'list',
|
||||
@@ -75,7 +75,7 @@ class ChargeRefundTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_non_recursive_save(self):
|
||||
charge = libraries.stripe.Charge.construct_from({
|
||||
charge = libraries.stripe3.Charge.construct_from({
|
||||
'id': 'ch_nested_update',
|
||||
'customer': {
|
||||
'object': 'customer',
|
||||
@@ -105,7 +105,7 @@ class ChargeRefundTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_fetch_refund(self):
|
||||
charge = libraries.stripe.Charge.construct_from({
|
||||
charge = libraries.stripe3.Charge.construct_from({
|
||||
'id': 'ch_get_refund',
|
||||
'refunds': {
|
||||
'object': 'list',
|
||||
@@ -123,7 +123,7 @@ class ChargeRefundTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_list_refunds(self):
|
||||
charge = libraries.stripe.Charge.construct_from({
|
||||
charge = libraries.stripe3.Charge.construct_from({
|
||||
'id': 'ch_get_refund',
|
||||
'refunds': {
|
||||
'object': 'list',
|
||||
@@ -141,7 +141,7 @@ class ChargeRefundTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_update_refund(self):
|
||||
refund = libraries.stripe.resource.Refund.construct_from({
|
||||
refund = libraries.stripe3.resource.Refund.construct_from({
|
||||
'id': "ref_update",
|
||||
'charge': "ch_update",
|
||||
'metadata': {},
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import libraries.stripe
|
||||
from libraries.stripe.test.helper import StripeResourceTest
|
||||
import libraries.stripe3
|
||||
from libraries.stripe3.test.helper import StripeResourceTest
|
||||
|
||||
|
||||
class ProductTest(StripeResourceTest):
|
||||
|
||||
def test_list_products(self):
|
||||
libraries.stripe.Product.list()
|
||||
libraries.stripe3.Product.list()
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'get',
|
||||
'/v1/products',
|
||||
@@ -13,7 +13,7 @@ class ProductTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_delete_products(self):
|
||||
p = libraries.stripe.Product(id='product_to_delete')
|
||||
p = libraries.stripe3.Product(id='product_to_delete')
|
||||
p.delete()
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
@@ -27,7 +27,7 @@ class ProductTest(StripeResourceTest):
|
||||
class SKUTest(StripeResourceTest):
|
||||
|
||||
def test_list_skus(self):
|
||||
libraries.stripe.SKU.list()
|
||||
libraries.stripe3.SKU.list()
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'get',
|
||||
'/v1/skus',
|
||||
@@ -35,7 +35,7 @@ class SKUTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_delete_skus(self):
|
||||
sku = libraries.stripe.SKU(id='sku_delete')
|
||||
sku = libraries.stripe3.SKU(id='sku_delete')
|
||||
sku.delete()
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
@@ -49,7 +49,7 @@ class SKUTest(StripeResourceTest):
|
||||
class OrderTest(StripeResourceTest):
|
||||
|
||||
def test_list_orders(self):
|
||||
libraries.stripe.Order.list()
|
||||
libraries.stripe3.Order.list()
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'get',
|
||||
'/v1/orders',
|
||||
@@ -57,7 +57,7 @@ class OrderTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_pay_order(self):
|
||||
order = libraries.stripe.Order(id="or_pay")
|
||||
order = libraries.stripe3.Order(id="or_pay")
|
||||
order.pay()
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
@@ -68,7 +68,7 @@ class OrderTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_return_order(self):
|
||||
order = libraries.stripe.Order(id="or_return")
|
||||
order = libraries.stripe3.Order(id="or_return")
|
||||
order.return_order()
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
@@ -82,7 +82,7 @@ class OrderTest(StripeResourceTest):
|
||||
class OrderReturnTest(StripeResourceTest):
|
||||
|
||||
def test_list_order_returns(self):
|
||||
libraries.stripe.OrderReturn.list()
|
||||
libraries.stripe3.OrderReturn.list()
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'get',
|
||||
'/v1/order_returns',
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import libraries.stripe
|
||||
from libraries.stripe.test.helper import StripeResourceTest
|
||||
import libraries.stripe3
|
||||
from libraries.stripe3.test.helper import StripeResourceTest
|
||||
|
||||
|
||||
class ReversalTest(StripeResourceTest):
|
||||
|
||||
def test_fetch_reversal(self):
|
||||
transfer = libraries.stripe.Charge.construct_from({
|
||||
transfer = libraries.stripe3.Charge.construct_from({
|
||||
'id': 'tr_get',
|
||||
'reversals': {
|
||||
'object': 'list',
|
||||
@@ -23,7 +23,7 @@ class ReversalTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_list_reversals(self):
|
||||
transfer = libraries.stripe.Charge.construct_from({
|
||||
transfer = libraries.stripe3.Charge.construct_from({
|
||||
'id': 'tr_list',
|
||||
'reversals': {
|
||||
'object': 'list',
|
||||
@@ -41,7 +41,7 @@ class ReversalTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_update_transfer(self):
|
||||
reversal = libraries.stripe.resource.Reversal.construct_from({
|
||||
reversal = libraries.stripe3.resource.Reversal.construct_from({
|
||||
'id': "rev_update",
|
||||
'transfer': "tr_update",
|
||||
'metadata': {},
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
import pickle
|
||||
import sys
|
||||
|
||||
import libraries.stripe
|
||||
from libraries.stripe import util
|
||||
from libraries.stripe.test.helper import StripeUnitTestCase, SAMPLE_INVOICE
|
||||
import libraries.stripe3
|
||||
from libraries.stripe3 import util
|
||||
from libraries.stripe3.test.helper import StripeUnitTestCase, SAMPLE_INVOICE
|
||||
|
||||
|
||||
class StripeObjectTests(StripeUnitTestCase):
|
||||
|
||||
def test_initializes_with_parameters(self):
|
||||
obj = libraries.stripe.resource.StripeObject(
|
||||
obj = libraries.stripe3.resource.StripeObject(
|
||||
'foo', 'bar', myparam=5, yourparam='boo')
|
||||
|
||||
self.assertEqual('foo', obj.id)
|
||||
self.assertEqual('bar', obj.api_key)
|
||||
|
||||
def test_access(self):
|
||||
obj = libraries.stripe.resource.StripeObject('myid', 'mykey', myparam=5)
|
||||
obj = libraries.stripe3.resource.StripeObject('myid', 'mykey', myparam=5)
|
||||
|
||||
# Empty
|
||||
self.assertRaises(AttributeError, getattr, obj, 'myattr')
|
||||
@@ -44,7 +44,7 @@ class StripeObjectTests(StripeUnitTestCase):
|
||||
self.assertRaises(ValueError, setattr, obj, 'foo', '')
|
||||
|
||||
def test_refresh_from(self):
|
||||
obj = libraries.stripe.resource.StripeObject.construct_from({
|
||||
obj = libraries.stripe3.resource.StripeObject.construct_from({
|
||||
'foo': 'bar',
|
||||
'trans': 'me',
|
||||
}, 'mykey')
|
||||
@@ -74,7 +74,7 @@ class StripeObjectTests(StripeUnitTestCase):
|
||||
self.assertEqual(4, obj.trans)
|
||||
|
||||
def test_passing_nested_refresh(self):
|
||||
obj = libraries.stripe.resource.StripeObject.construct_from({
|
||||
obj = libraries.stripe3.resource.StripeObject.construct_from({
|
||||
'foos': {
|
||||
'type': 'list',
|
||||
'data': [
|
||||
@@ -91,17 +91,17 @@ class StripeObjectTests(StripeUnitTestCase):
|
||||
self.assertEqual('acct_foo', nested.stripe_account)
|
||||
|
||||
def test_refresh_from_nested_object(self):
|
||||
obj = libraries.stripe.resource.StripeObject.construct_from(
|
||||
obj = libraries.stripe3.resource.StripeObject.construct_from(
|
||||
SAMPLE_INVOICE, 'key')
|
||||
|
||||
self.assertEqual(1, len(obj.lines.subscriptions))
|
||||
self.assertTrue(
|
||||
isinstance(obj.lines.subscriptions[0],
|
||||
libraries.stripe.resource.StripeObject))
|
||||
libraries.stripe3.resource.StripeObject))
|
||||
self.assertEqual('month', obj.lines.subscriptions[0].plan.interval)
|
||||
|
||||
def test_to_json(self):
|
||||
obj = libraries.stripe.resource.StripeObject.construct_from(
|
||||
obj = libraries.stripe3.resource.StripeObject.construct_from(
|
||||
SAMPLE_INVOICE, 'key')
|
||||
|
||||
self.check_invoice_data(util.json.loads(str(obj)))
|
||||
@@ -121,7 +121,7 @@ class StripeObjectTests(StripeUnitTestCase):
|
||||
data['lines']['subscriptions'][0]['plan']['interval'])
|
||||
|
||||
def test_repr(self):
|
||||
obj = libraries.stripe.resource.StripeObject(
|
||||
obj = libraries.stripe3.resource.StripeObject(
|
||||
'foo', 'bar', myparam=5)
|
||||
|
||||
obj['object'] = '\u4e00boo\u1f00'
|
||||
@@ -135,7 +135,7 @@ class StripeObjectTests(StripeUnitTestCase):
|
||||
self.assertTrue('id=foo' in res)
|
||||
|
||||
def test_pickling(self):
|
||||
obj = libraries.stripe.resource.StripeObject(
|
||||
obj = libraries.stripe3.resource.StripeObject(
|
||||
'foo', 'bar', myparam=5)
|
||||
|
||||
obj['object'] = 'boo'
|
||||
@@ -152,7 +152,7 @@ class StripeObjectTests(StripeUnitTestCase):
|
||||
self.assertEqual('lalala', newobj.fala)
|
||||
|
||||
def test_deletion(self):
|
||||
obj = libraries.stripe.resource.StripeObject('id', 'key')
|
||||
obj = libraries.stripe3.resource.StripeObject('id', 'key')
|
||||
|
||||
obj.coupon = "foo"
|
||||
self.assertEqual('foo', obj.coupon)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import datetime
|
||||
import time
|
||||
|
||||
import libraries.stripe
|
||||
from libraries.stripe.test.helper import (
|
||||
import libraries.stripe3
|
||||
from libraries.stripe3.test.helper import (
|
||||
StripeResourceTest, DUMMY_PLAN
|
||||
)
|
||||
|
||||
@@ -10,7 +10,7 @@ from libraries.stripe.test.helper import (
|
||||
class SubscriptionTest(StripeResourceTest):
|
||||
|
||||
def test_list_subscriptions(self):
|
||||
libraries.stripe.Subscription.all(customer="test_cus", plan=DUMMY_PLAN['id'],
|
||||
libraries.stripe3.Subscription.all(customer="test_cus", plan=DUMMY_PLAN['id'],
|
||||
limit=3)
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'get',
|
||||
@@ -23,7 +23,7 @@ class SubscriptionTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_retrieve_subscription(self):
|
||||
libraries.stripe.Subscription.retrieve('test_sub')
|
||||
libraries.stripe3.Subscription.retrieve('test_sub')
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'get',
|
||||
@@ -33,7 +33,7 @@ class SubscriptionTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_create_subscription(self):
|
||||
libraries.stripe.Subscription.create(customer="test_cus", plan=DUMMY_PLAN['id'])
|
||||
libraries.stripe3.Subscription.create(customer="test_cus", plan=DUMMY_PLAN['id'])
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'post',
|
||||
@@ -46,7 +46,7 @@ class SubscriptionTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_update_subscription(self):
|
||||
subscription = libraries.stripe.Subscription.construct_from({
|
||||
subscription = libraries.stripe3.Subscription.construct_from({
|
||||
'id': 'test_sub',
|
||||
'customer': 'test_cus',
|
||||
}, 'api_key')
|
||||
@@ -72,7 +72,7 @@ class SubscriptionTest(StripeResourceTest):
|
||||
trial_end_dttm = datetime.datetime.now() + datetime.timedelta(days=15)
|
||||
trial_end_int = int(time.mktime(trial_end_dttm.timetuple()))
|
||||
|
||||
libraries.stripe.Subscription.modify('test_sub',
|
||||
libraries.stripe3.Subscription.modify('test_sub',
|
||||
plan=DUMMY_PLAN['id'],
|
||||
trial_end=trial_end_int)
|
||||
|
||||
@@ -87,7 +87,7 @@ class SubscriptionTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_delete_subscription(self):
|
||||
subscription = libraries.stripe.Subscription.construct_from({
|
||||
subscription = libraries.stripe3.Subscription.construct_from({
|
||||
'id': 'test_sub',
|
||||
'customer': 'test_cus',
|
||||
}, 'api_key')
|
||||
@@ -102,7 +102,7 @@ class SubscriptionTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_delete_subscription_discount(self):
|
||||
subscription = libraries.stripe.Subscription.construct_from({
|
||||
subscription = libraries.stripe3.Subscription.construct_from({
|
||||
'id': 'test_sub',
|
||||
'customer': 'test_cus',
|
||||
'coupon': 'test_discount'
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import libraries.stripe
|
||||
from libraries.stripe.test.helper import StripeResourceTest
|
||||
import libraries.stripe3
|
||||
from libraries.stripe3.test.helper import StripeResourceTest
|
||||
|
||||
|
||||
class ThreeDSecureTest(StripeResourceTest):
|
||||
|
||||
def test_threedsecure_create(self):
|
||||
libraries.stripe.ThreeDSecure.create(
|
||||
libraries.stripe3.ThreeDSecure.create(
|
||||
card="tok_test",
|
||||
amount=1500,
|
||||
currency="usd",
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import libraries.stripe
|
||||
from libraries.stripe.test.helper import StripeResourceTest
|
||||
import libraries.stripe3
|
||||
from libraries.stripe3.test.helper import StripeResourceTest
|
||||
|
||||
|
||||
class TransferTest(StripeResourceTest):
|
||||
|
||||
def test_list_transfers(self):
|
||||
libraries.stripe.Transfer.list()
|
||||
libraries.stripe3.Transfer.list()
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
'get',
|
||||
'/v1/transfers',
|
||||
@@ -13,7 +13,7 @@ class TransferTest(StripeResourceTest):
|
||||
)
|
||||
|
||||
def test_cancel_transfer(self):
|
||||
transfer = libraries.stripe.Transfer(id='tr_cancel')
|
||||
transfer = libraries.stripe3.Transfer(id='tr_cancel')
|
||||
transfer.cancel()
|
||||
|
||||
self.requestor_mock.request.assert_called_with(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from libraries.stripe.test.helper import (
|
||||
from libraries.stripe3.test.helper import (
|
||||
StripeApiTestCase, MyUpdateable
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user