mirror of
https://github.com/gooba42/adventureland.git
synced 2026-10-14 10:33:47 -05:00
stripe fixes
This commit is contained in:
@@ -114,14 +114,14 @@ if is_production:
|
||||
#maps["desertland"]["key"]="jayson_desertland_copy"
|
||||
pass
|
||||
|
||||
game_version=789
|
||||
game_version=790
|
||||
SALES=4+5+388+5101+125/20 #donation+manual+macos+steam+sales
|
||||
update_notes=[
|
||||
"Lunar New Year Event",
|
||||
"Valentines Day Event",
|
||||
"Last Update [6th of February]",
|
||||
"Last Update [10th of February]",
|
||||
"Switched to Python3",
|
||||
"All major issues fixed",
|
||||
"Testing a more performant instance type to run the backend",
|
||||
|
||||
]
|
||||
ip_to_subdomain={ #IMPORTANT: SPECIAL PAGE RULES ARE NEEDED: https://dash.cloudflare.com/b6f5a13bded5fdd273e4a1cd3777162d/adventure.land/page-rules - uss1 / eus1 was best
|
||||
|
||||
File diff suppressed because one or more lines are too long
+15
-6
@@ -276,7 +276,7 @@ def selection_info(self,user,domain):
|
||||
return {"type":"content","html":shtml("htmls/contents/selection.html",user=user,domain=domain,server=server,servers=servers,characters=get_characters(user))}
|
||||
|
||||
def security_threat(request,domain):
|
||||
return False
|
||||
#return False
|
||||
referer=request.headers.get('Referer') or request.headers.get('Origin') or ""
|
||||
if not referer: return False
|
||||
|
||||
@@ -1031,12 +1031,21 @@ def verify_steam_installs():
|
||||
for id in checks:
|
||||
try:
|
||||
result=checks[id].get_result()
|
||||
if result.content.find('"ownsapp":true')!=-1:
|
||||
logging.info("%s yes!"%id)
|
||||
elif result.content.find('"ownsapp":false')!=-1:
|
||||
logging.error("%s no!"%id)
|
||||
if 1/2==0:
|
||||
if result.content.find(b'"ownsapp":true')!=-1:
|
||||
logging.info("%s yes!"%id)
|
||||
elif result.content.find('"ownsapp":false')!=-1:
|
||||
logging.error("%s no!"%id)
|
||||
else:
|
||||
logging.error("%s Unhandled output %s"%(id,result.content))
|
||||
else:
|
||||
logging.error("%s Unhandled output %s"%(id,result.content))
|
||||
result=checks[id].get_result()
|
||||
if b'"ownsapp":true' in result.content:
|
||||
logging.info("%s yes!"%id)
|
||||
elif b'"ownsapp":false' in result.content:
|
||||
logging.error("%s no!"%id)
|
||||
else:
|
||||
logging.error("%s Unhandled output %s"%(id,result.content))
|
||||
except:
|
||||
log_trace()
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ verify_ssl_certs = True
|
||||
default_http_client = None
|
||||
|
||||
# Resource
|
||||
from libraries.stripe.resource import ( # noqa
|
||||
from libraries.stripe3.resource import ( # noqa
|
||||
Account,
|
||||
AlipayAccount,
|
||||
ApplicationFee,
|
||||
@@ -50,7 +50,7 @@ from libraries.stripe.resource import ( # noqa
|
||||
# namespace in the future and you should prefer to access them via
|
||||
# the fully qualified `stripe.error` module.
|
||||
|
||||
from libraries.stripe.error import ( # noqa
|
||||
from libraries.stripe3.error import ( # noqa
|
||||
APIConnectionError,
|
||||
APIError,
|
||||
AuthenticationError,
|
||||
@@ -62,9 +62,9 @@ from libraries.stripe.error import ( # noqa
|
||||
# DEPRECATED: These imports will be moved out of the root stripe namespace
|
||||
# in version 2.0
|
||||
|
||||
from libraries.stripe.version import VERSION # noqa
|
||||
from libraries.stripe.api_requestor import APIRequestor # noqa
|
||||
from libraries.stripe.resource import ( # noqa
|
||||
from libraries.stripe3.version import VERSION # noqa
|
||||
from libraries.stripe3.api_requestor import APIRequestor # noqa
|
||||
from libraries.stripe3.resource import ( # noqa
|
||||
APIResource,
|
||||
CreateableAPIResource,
|
||||
DeletableAPIResource,
|
||||
@@ -75,4 +75,4 @@ from libraries.stripe.resource import ( # noqa
|
||||
StripeObjectEncoder,
|
||||
UpdateableAPIResource,
|
||||
convert_to_stripe_object)
|
||||
from libraries.stripe.util import json, logger # noqa
|
||||
from libraries.stripe3.util import json, logger # noqa
|
||||
|
||||
@@ -6,9 +6,9 @@ import urllib.request, urllib.parse, urllib.error
|
||||
import urllib.parse
|
||||
import warnings
|
||||
|
||||
import libraries.stripe
|
||||
from libraries.stripe import error, http_client, version, util
|
||||
from libraries.stripe.multipart_data_generator import MultipartDataGenerator
|
||||
import libraries.stripe3
|
||||
from libraries.stripe3 import error, http_client, version, util
|
||||
from libraries.stripe3.multipart_data_generator import MultipartDataGenerator
|
||||
|
||||
|
||||
def _encode_datetime(dttime):
|
||||
@@ -64,13 +64,13 @@ def _build_api_url(url, query):
|
||||
class APIRequestor(object):
|
||||
|
||||
def __init__(self, key=None, client=None, api_base=None, account=None):
|
||||
self.api_base = api_base or libraries.stripe.api_base
|
||||
self.api_base = api_base or libraries.stripe3.api_base
|
||||
self.api_key = key
|
||||
self.stripe_account = account
|
||||
|
||||
from libraries.stripe import verify_ssl_certs as verify
|
||||
from libraries.stripe3 import verify_ssl_certs as verify
|
||||
|
||||
self._client = client or libraries.stripe.default_http_client or \
|
||||
self._client = client or libraries.stripe3.default_http_client or \
|
||||
http_client.new_default_http_client(verify_ssl_certs=verify)
|
||||
|
||||
@classmethod
|
||||
@@ -171,12 +171,12 @@ class APIRequestor(object):
|
||||
"""
|
||||
Mechanism for issuing an API call
|
||||
"""
|
||||
from libraries.stripe import api_version
|
||||
from libraries.stripe3 import api_version
|
||||
|
||||
if self.api_key:
|
||||
my_api_key = self.api_key
|
||||
else:
|
||||
from libraries.stripe import api_key
|
||||
from libraries.stripe3 import api_key
|
||||
my_api_key = api_key
|
||||
|
||||
if my_api_key is None:
|
||||
@@ -306,37 +306,37 @@ class APIRequestor(object):
|
||||
return client._handle_request_error(*args)
|
||||
|
||||
def requests_request(self, meth, abs_url, headers, params):
|
||||
from libraries.stripe.http_client import RequestsClient
|
||||
from libraries.stripe3.http_client import RequestsClient
|
||||
return self._deprecated_request(RequestsClient, meth, abs_url,
|
||||
headers, params)
|
||||
|
||||
def handle_requests_error(self, err):
|
||||
from libraries.stripe.http_client import RequestsClient
|
||||
from libraries.stripe3.http_client import RequestsClient
|
||||
return self._deprecated_handle_error(RequestsClient, err)
|
||||
|
||||
def pycurl_request(self, meth, abs_url, headers, params):
|
||||
from libraries.stripe.http_client import PycurlClient
|
||||
from libraries.stripe3.http_client import PycurlClient
|
||||
return self._deprecated_request(PycurlClient, meth, abs_url,
|
||||
headers, params)
|
||||
|
||||
def handle_pycurl_error(self, err):
|
||||
from libraries.stripe.http_client import PycurlClient
|
||||
from libraries.stripe3.http_client import PycurlClient
|
||||
return self._deprecated_handle_error(PycurlClient, err)
|
||||
|
||||
def urlfetch_request(self, meth, abs_url, headers, params):
|
||||
from libraries.stripe.http_client import UrlFetchClient
|
||||
from libraries.stripe3.http_client import UrlFetchClient
|
||||
return self._deprecated_request(UrlFetchClient, meth, abs_url,
|
||||
headers, params)
|
||||
|
||||
def handle_urlfetch_error(self, err, abs_url):
|
||||
from libraries.stripe.http_client import UrlFetchClient
|
||||
from libraries.stripe3.http_client import UrlFetchClient
|
||||
return self._deprecated_handle_error(UrlFetchClient, err, abs_url)
|
||||
|
||||
def urllib2_request(self, meth, abs_url, headers, params):
|
||||
from libraries.stripe.http_client import Urllib2Client
|
||||
from libraries.stripe3.http_client import Urllib2Client
|
||||
return self._deprecated_request(Urllib2Client, meth, abs_url,
|
||||
headers, params)
|
||||
|
||||
def handle_urllib2_error(self, err, abs_url):
|
||||
from libraries.stripe.http_client import Urllib2Client
|
||||
from libraries.stripe3.http_client import Urllib2Client
|
||||
return self._deprecated_handle_error(Urllib2Client, err)
|
||||
|
||||
@@ -6,7 +6,7 @@ import email
|
||||
|
||||
if 1/2 != 0: str=str
|
||||
|
||||
from libraries.stripe import error, util
|
||||
from libraries.stripe3 import error, util
|
||||
|
||||
|
||||
# - Requests is the preferred HTTP library
|
||||
|
||||
@@ -12,5 +12,5 @@ def import_json():
|
||||
"`from importer import json` instead'",
|
||||
DeprecationWarning)
|
||||
|
||||
from libraries.stripe.util import json
|
||||
from libraries.stripe3.util import json
|
||||
return json
|
||||
|
||||
@@ -2,9 +2,7 @@ import urllib.request, urllib.parse, urllib.error
|
||||
import warnings
|
||||
import sys
|
||||
|
||||
if 1/2 != 0: str=str
|
||||
|
||||
from libraries.stripe import api_requestor, error, util, upload_api_base
|
||||
from libraries.stripe3 import api_requestor, error, util, upload_api_base
|
||||
|
||||
|
||||
def convert_to_stripe_object(resp, api_key, account):
|
||||
|
||||
@@ -10,7 +10,7 @@ if 1/2 != 0: str=str
|
||||
|
||||
from mock import patch, Mock
|
||||
|
||||
import libraries.stripe
|
||||
import libraries.stripe3
|
||||
|
||||
NOW = datetime.datetime.now()
|
||||
|
||||
@@ -68,7 +68,7 @@ DUMMY_INVOICE_ITEM = {
|
||||
'currency': 'usd',
|
||||
}
|
||||
|
||||
SAMPLE_INVOICE = libraries.stripe.util.json.loads("""
|
||||
SAMPLE_INVOICE = libraries.stripe3.util.json.loads("""
|
||||
{
|
||||
"amount_due": 1305,
|
||||
"attempt_count": 0,
|
||||
@@ -130,8 +130,8 @@ class StripeTestCase(unittest2.TestCase):
|
||||
|
||||
api_base = os.environ.get('STRIPE_API_BASE')
|
||||
if api_base:
|
||||
libraries.stripe.api_base = api_base
|
||||
libraries.stripe.api_key = os.environ.get(
|
||||
libraries.stripe3.api_base = api_base
|
||||
libraries.stripe3.api_key = os.environ.get(
|
||||
'STRIPE_API_KEY', 'tGN0bIwXnHdwOa85VABjPdSn8nWY7G7I')
|
||||
|
||||
def tearDown(self):
|
||||
@@ -234,7 +234,7 @@ class MyDeletable(stripe.resource.DeletableAPIResource):
|
||||
|
||||
|
||||
class MyComposite(stripe.resource.ListableAPIResource,
|
||||
libraries.stripe.resource.CreateableAPIResource,
|
||||
libraries.stripe.resource.UpdateableAPIResource,
|
||||
libraries.stripe.resource.DeletableAPIResource):
|
||||
libraries.stripe3.resource.CreateableAPIResource,
|
||||
libraries.stripe3.resource.UpdateableAPIResource,
|
||||
libraries.stripe3.resource.DeletableAPIResource):
|
||||
pass
|
||||
|
||||
@@ -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
|
||||
)
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ import sys
|
||||
|
||||
import unittest2
|
||||
|
||||
from libraries.stripe import StripeError
|
||||
from libraries.stripe.test.helper import StripeUnitTestCase
|
||||
from libraries.stripe3 import StripeError
|
||||
from libraries.stripe3.test.helper import StripeUnitTestCase
|
||||
|
||||
|
||||
class StripeErrorTests(StripeUnitTestCase):
|
||||
|
||||
@@ -5,9 +5,9 @@ if 1/2 != 0: str=str
|
||||
|
||||
from mock import Mock, patch
|
||||
|
||||
import libraries.stripe
|
||||
import libraries.stripe3
|
||||
|
||||
from libraries.stripe.test.helper import StripeUnitTestCase
|
||||
from libraries.stripe3.test.helper import StripeUnitTestCase
|
||||
|
||||
VALID_API_METHODS = ('get', 'post', 'delete')
|
||||
|
||||
@@ -17,11 +17,11 @@ class HttpClientTests(StripeUnitTestCase):
|
||||
def setUp(self):
|
||||
super(HttpClientTests, self).setUp()
|
||||
|
||||
self.original_filters = libraries.stripe.http_client.warnings.filters[:]
|
||||
libraries.stripe.http_client.warnings.simplefilter('ignore')
|
||||
self.original_filters = libraries.stripe3.http_client.warnings.filters[:]
|
||||
libraries.stripe3.http_client.warnings.simplefilter('ignore')
|
||||
|
||||
def tearDown(self):
|
||||
libraries.stripe.http_client.warnings.filters = self.original_filters
|
||||
libraries.stripe3.http_client.warnings.filters = self.original_filters
|
||||
|
||||
super(HttpClientTests, self).tearDown()
|
||||
|
||||
@@ -29,25 +29,25 @@ class HttpClientTests(StripeUnitTestCase):
|
||||
for lib in none_libs:
|
||||
setattr(stripe.http_client, lib, None)
|
||||
|
||||
inst = libraries.stripe.http_client.new_default_http_client()
|
||||
inst = libraries.stripe3.http_client.new_default_http_client()
|
||||
|
||||
self.assertTrue(isinstance(inst, expected))
|
||||
|
||||
def test_new_default_http_client_urlfetch(self):
|
||||
self.check_default((),
|
||||
libraries.stripe.http_client.UrlFetchClient)
|
||||
libraries.stripe3.http_client.UrlFetchClient)
|
||||
|
||||
def test_new_default_http_client_requests(self):
|
||||
self.check_default(('urlfetch',),
|
||||
libraries.stripe.http_client.RequestsClient)
|
||||
libraries.stripe3.http_client.RequestsClient)
|
||||
|
||||
def test_new_default_http_client_pycurl(self):
|
||||
self.check_default(('urlfetch', 'requests',),
|
||||
libraries.stripe.http_client.PycurlClient)
|
||||
libraries.stripe3.http_client.PycurlClient)
|
||||
|
||||
def test_new_default_http_client_urllib2(self):
|
||||
self.check_default(('urlfetch', 'requests', 'pycurl'),
|
||||
libraries.stripe.http_client.Urllib2Client)
|
||||
libraries.stripe3.http_client.Urllib2Client)
|
||||
|
||||
|
||||
class ClientTestBase():
|
||||
@@ -112,7 +112,7 @@ class RequestsVerify(object):
|
||||
|
||||
|
||||
class RequestsClientTests(StripeUnitTestCase, ClientTestBase):
|
||||
request_client = libraries.stripe.http_client.RequestsClient
|
||||
request_client = libraries.stripe3.http_client.RequestsClient
|
||||
|
||||
def mock_response(self, mock, body, code):
|
||||
result = Mock()
|
||||
@@ -134,7 +134,7 @@ class RequestsClientTests(StripeUnitTestCase, ClientTestBase):
|
||||
|
||||
|
||||
class UrlFetchClientTests(StripeUnitTestCase, ClientTestBase):
|
||||
request_client = libraries.stripe.http_client.UrlFetchClient
|
||||
request_client = libraries.stripe3.http_client.UrlFetchClient
|
||||
|
||||
def mock_response(self, mock, body, code):
|
||||
result = Mock()
|
||||
@@ -159,7 +159,7 @@ class UrlFetchClientTests(StripeUnitTestCase, ClientTestBase):
|
||||
|
||||
|
||||
class Urllib2ClientTests(StripeUnitTestCase, ClientTestBase):
|
||||
request_client = libraries.stripe.http_client.Urllib2Client
|
||||
request_client = libraries.stripe3.http_client.Urllib2Client
|
||||
|
||||
def mock_response(self, mock, body, code):
|
||||
response = Mock
|
||||
@@ -184,7 +184,7 @@ class Urllib2ClientTests(StripeUnitTestCase, ClientTestBase):
|
||||
|
||||
|
||||
class PycurlClientTests(StripeUnitTestCase, ClientTestBase):
|
||||
request_client = libraries.stripe.http_client.PycurlClient
|
||||
request_client = libraries.stripe3.http_client.PycurlClient
|
||||
|
||||
@property
|
||||
def request_mock(self):
|
||||
@@ -222,8 +222,8 @@ class PycurlClientTests(StripeUnitTestCase, ClientTestBase):
|
||||
def __getitem__(self, i):
|
||||
return 'foo'
|
||||
|
||||
libraries.stripe.http_client.pycurl.error = FakeException
|
||||
mock.perform.side_effect = libraries.stripe.http_client.pycurl.error
|
||||
libraries.stripe3.http_client.pycurl.error = FakeException
|
||||
mock.perform.side_effect = libraries.stripe3.http_client.pycurl.error
|
||||
|
||||
def check_call(self, mock, meth, url, post_data, headers):
|
||||
# TODO: Check the setopt calls
|
||||
@@ -242,7 +242,7 @@ class APIEncodeTest(StripeUnitTestCase):
|
||||
},
|
||||
}
|
||||
|
||||
values = [t for t in libraries.stripe.api_requestor._api_encode(body)]
|
||||
values = [t for t in libraries.stripe3.api_requestor._api_encode(body)]
|
||||
|
||||
self.assertTrue(('foo[dob][month]', 1) in values)
|
||||
self.assertTrue(('foo[name]', 'bat') in values)
|
||||
@@ -257,7 +257,7 @@ class APIEncodeTest(StripeUnitTestCase):
|
||||
}],
|
||||
}
|
||||
|
||||
values = [t for t in libraries.stripe.api_requestor._api_encode(body)]
|
||||
values = [t for t in libraries.stripe3.api_requestor._api_encode(body)]
|
||||
|
||||
self.assertTrue(('foo[][dob][month]', 1) in values)
|
||||
self.assertTrue(('foo[][name]', 'bat') in values)
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
import os
|
||||
import sys
|
||||
import unittest2
|
||||
import libraries.stripe
|
||||
import libraries.stripe3
|
||||
|
||||
if 1/2 != 0: str=str
|
||||
|
||||
from mock import patch
|
||||
from libraries.stripe.test.helper import (StripeTestCase, NOW, DUMMY_CHARGE, DUMMY_CARD)
|
||||
from libraries.stripe3.test.helper import (StripeTestCase, NOW, DUMMY_CHARGE, DUMMY_CARD)
|
||||
|
||||
|
||||
class FunctionalTests(StripeTestCase):
|
||||
request_client = libraries.stripe.http_client.Urllib2Client
|
||||
request_client = libraries.stripe3.http_client.Urllib2Client
|
||||
|
||||
def setUp(self):
|
||||
super(FunctionalTests, self).setUp()
|
||||
@@ -31,23 +31,23 @@ class FunctionalTests(StripeTestCase):
|
||||
self.client_patcher.stop()
|
||||
|
||||
def test_dns_failure(self):
|
||||
api_base = libraries.stripe.api_base
|
||||
api_base = libraries.stripe3.api_base
|
||||
try:
|
||||
libraries.stripe.api_base = 'https://my-invalid-domain.ireallywontresolve/v1'
|
||||
libraries.stripe3.api_base = 'https://my-invalid-domain.ireallywontresolve/v1'
|
||||
self.assertRaises(stripe.error.APIConnectionError,
|
||||
libraries.stripe.Customer.create)
|
||||
libraries.stripe3.Customer.create)
|
||||
finally:
|
||||
libraries.stripe.api_base = api_base
|
||||
libraries.stripe3.api_base = api_base
|
||||
|
||||
def test_run(self):
|
||||
charge = libraries.stripe.Charge.create(**DUMMY_CHARGE)
|
||||
charge = libraries.stripe3.Charge.create(**DUMMY_CHARGE)
|
||||
self.assertFalse(charge.refunded)
|
||||
charge.refund()
|
||||
self.assertTrue(charge.refunded)
|
||||
|
||||
def test_refresh(self):
|
||||
charge = libraries.stripe.Charge.create(**DUMMY_CHARGE)
|
||||
charge2 = libraries.stripe.Charge.retrieve(charge.id)
|
||||
charge = libraries.stripe3.Charge.create(**DUMMY_CHARGE)
|
||||
charge2 = libraries.stripe3.Charge.retrieve(charge.id)
|
||||
self.assertEqual(charge2.created, charge.created)
|
||||
|
||||
charge2.junk = 'junk'
|
||||
@@ -55,7 +55,7 @@ class FunctionalTests(StripeTestCase):
|
||||
self.assertRaises(AttributeError, lambda: charge2.junk)
|
||||
|
||||
def test_list_accessors(self):
|
||||
customer = libraries.stripe.Customer.create(card=DUMMY_CARD)
|
||||
customer = libraries.stripe3.Customer.create(card=DUMMY_CARD)
|
||||
self.assertEqual(customer['created'], customer.created)
|
||||
customer['foo'] = 'bar'
|
||||
self.assertEqual(customer.foo, 'bar')
|
||||
@@ -64,7 +64,7 @@ class FunctionalTests(StripeTestCase):
|
||||
EXPIRED_CARD = DUMMY_CARD.copy()
|
||||
EXPIRED_CARD['exp_month'] = NOW.month - 2
|
||||
EXPIRED_CARD['exp_year'] = NOW.year - 2
|
||||
self.assertRaises(stripe.error.CardError, libraries.stripe.Charge.create,
|
||||
self.assertRaises(stripe.error.CardError, libraries.stripe3.Charge.create,
|
||||
amount=100, currency='usd', card=EXPIRED_CARD)
|
||||
|
||||
def test_response_headers(self):
|
||||
@@ -72,35 +72,35 @@ class FunctionalTests(StripeTestCase):
|
||||
EXPIRED_CARD['exp_month'] = NOW.month - 2
|
||||
EXPIRED_CARD['exp_year'] = NOW.year - 2
|
||||
try:
|
||||
libraries.stripe.Charge.create(amount=100, currency='usd', card=EXPIRED_CARD)
|
||||
libraries.stripe3.Charge.create(amount=100, currency='usd', card=EXPIRED_CARD)
|
||||
self.fail('charge creation with expired card did not fail')
|
||||
except libraries.stripe.error.CardError as e:
|
||||
except libraries.stripe3.error.CardError as e:
|
||||
self.assertTrue(e.request_id.startswith('req_'))
|
||||
|
||||
def test_unicode(self):
|
||||
# Make sure unicode requests can be sent
|
||||
self.assertRaises(stripe.error.InvalidRequestError,
|
||||
libraries.stripe.Charge.retrieve,
|
||||
libraries.stripe3.Charge.retrieve,
|
||||
id='☃')
|
||||
|
||||
def test_none_values(self):
|
||||
customer = libraries.stripe.Customer.create(plan=None)
|
||||
customer = libraries.stripe3.Customer.create(plan=None)
|
||||
self.assertTrue(customer.id)
|
||||
|
||||
def test_missing_id(self):
|
||||
customer = libraries.stripe.Customer()
|
||||
customer = libraries.stripe3.Customer()
|
||||
self.assertRaises(stripe.error.InvalidRequestError, customer.refresh)
|
||||
|
||||
|
||||
class RequestsFunctionalTests(FunctionalTests):
|
||||
request_client = libraries.stripe.http_client.RequestsClient
|
||||
request_client = libraries.stripe3.http_client.RequestsClient
|
||||
|
||||
|
||||
class UrlfetchFunctionalTests(FunctionalTests):
|
||||
request_client = 'urlfetch'
|
||||
|
||||
def setUp(self):
|
||||
if libraries.stripe.http_client.urlfetch is None:
|
||||
if libraries.stripe3.http_client.urlfetch is None:
|
||||
self.skipTest(
|
||||
'`urlfetch` from Google App Engine is unavailable.')
|
||||
else:
|
||||
@@ -117,17 +117,17 @@ class PycurlFunctionalTests(FunctionalTests):
|
||||
else:
|
||||
super(PycurlFunctionalTests, self).setUp()
|
||||
|
||||
request_client = libraries.stripe.http_client.PycurlClient
|
||||
request_client = libraries.stripe3.http_client.PycurlClient
|
||||
|
||||
|
||||
class AuthenticationErrorTest(StripeTestCase):
|
||||
|
||||
def test_invalid_credentials(self):
|
||||
key = libraries.stripe.api_key
|
||||
key = libraries.stripe3.api_key
|
||||
try:
|
||||
libraries.stripe.api_key = 'invalid'
|
||||
libraries.stripe.Customer.create()
|
||||
except libraries.stripe.error.AuthenticationError as e:
|
||||
libraries.stripe3.api_key = 'invalid'
|
||||
libraries.stripe3.Customer.create()
|
||||
except libraries.stripe3.error.AuthenticationError as e:
|
||||
self.assertEqual(401, e.http_status)
|
||||
self.assertTrue(isinstance(e.http_body, str))
|
||||
self.assertTrue(isinstance(e.json_body, dict))
|
||||
@@ -135,7 +135,7 @@ class AuthenticationErrorTest(StripeTestCase):
|
||||
# facilities in the API server so currently no Request ID is
|
||||
# returned.
|
||||
finally:
|
||||
libraries.stripe.api_key = key
|
||||
libraries.stripe3.api_key = key
|
||||
|
||||
|
||||
class CardErrorTest(StripeTestCase):
|
||||
@@ -145,8 +145,8 @@ class CardErrorTest(StripeTestCase):
|
||||
EXPIRED_CARD['exp_month'] = NOW.month - 2
|
||||
EXPIRED_CARD['exp_year'] = NOW.year - 2
|
||||
try:
|
||||
libraries.stripe.Charge.create(amount=100, currency='usd', card=EXPIRED_CARD)
|
||||
except libraries.stripe.error.CardError as e:
|
||||
libraries.stripe3.Charge.create(amount=100, currency='usd', card=EXPIRED_CARD)
|
||||
except libraries.stripe3.error.CardError as e:
|
||||
self.assertEqual(402, e.http_status)
|
||||
self.assertTrue(isinstance(e.http_body, str))
|
||||
self.assertTrue(isinstance(e.json_body, dict))
|
||||
@@ -157,8 +157,8 @@ class InvalidRequestErrorTest(StripeTestCase):
|
||||
|
||||
def test_nonexistent_object(self):
|
||||
try:
|
||||
libraries.stripe.Charge.retrieve('invalid')
|
||||
except libraries.stripe.error.InvalidRequestError as e:
|
||||
libraries.stripe3.Charge.retrieve('invalid')
|
||||
except libraries.stripe3.error.InvalidRequestError as e:
|
||||
self.assertEqual(404, e.http_status)
|
||||
self.assertTrue(isinstance(e.http_body, str))
|
||||
self.assertTrue(isinstance(e.json_body, dict))
|
||||
@@ -166,8 +166,8 @@ class InvalidRequestErrorTest(StripeTestCase):
|
||||
|
||||
def test_invalid_data(self):
|
||||
try:
|
||||
libraries.stripe.Charge.create()
|
||||
except libraries.stripe.error.InvalidRequestError as e:
|
||||
libraries.stripe3.Charge.create()
|
||||
except libraries.stripe3.error.InvalidRequestError as e:
|
||||
self.assertEqual(400, e.http_status)
|
||||
self.assertTrue(isinstance(e.http_body, str))
|
||||
self.assertTrue(isinstance(e.json_body, dict))
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
import re
|
||||
import sys
|
||||
|
||||
from libraries.stripe.multipart_data_generator import MultipartDataGenerator
|
||||
from libraries.stripe.test.helper import StripeTestCase
|
||||
from libraries.stripe3.multipart_data_generator import MultipartDataGenerator
|
||||
from libraries.stripe3.test.helper import StripeTestCase
|
||||
|
||||
|
||||
class MultipartDataGeneratorTests(StripeTestCase):
|
||||
|
||||
@@ -4,9 +4,9 @@ import urllib.parse
|
||||
|
||||
from mock import Mock, ANY
|
||||
|
||||
import libraries.stripe
|
||||
import libraries.stripe3
|
||||
|
||||
from libraries.stripe.test.helper import StripeUnitTestCase
|
||||
from libraries.stripe3.test.helper import StripeUnitTestCase
|
||||
|
||||
VALID_API_METHODS = ('get', 'post', 'delete')
|
||||
|
||||
@@ -29,7 +29,7 @@ class APIHeaderMatcher(object):
|
||||
|
||||
def __init__(self, api_key=None, extra={}, request_method=None):
|
||||
self.request_method = request_method
|
||||
self.api_key = api_key or libraries.stripe.api_key
|
||||
self.api_key = api_key or libraries.stripe3.api_key
|
||||
self.extra = extra
|
||||
|
||||
def __eq__(self, other):
|
||||
@@ -64,7 +64,7 @@ class QueryMatcher(object):
|
||||
def __eq__(self, other):
|
||||
query = urllib.parse.urlsplit(other).query or other
|
||||
|
||||
parsed = libraries.stripe.util.parse_qsl(query)
|
||||
parsed = libraries.stripe3.util.parse_qsl(query)
|
||||
return self.expected == sorted(parsed)
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ class APIRequestorRequestTests(StripeUnitTestCase):
|
||||
('%s[]', 'baz'),
|
||||
],
|
||||
'string': [('%s', 'boo')],
|
||||
'unicode': [('%s', libraries.stripe.util.utf8('\u1234'))],
|
||||
'unicode': [('%s', libraries.stripe3.util.utf8('\u1234'))],
|
||||
'datetime': [('%s', 1356994801)],
|
||||
'none': [],
|
||||
}
|
||||
@@ -136,7 +136,7 @@ class APIRequestorRequestTests(StripeUnitTestCase):
|
||||
self.http_client._verify_ssl_certs = True
|
||||
self.http_client.name = 'mockclient'
|
||||
|
||||
self.requestor = libraries.stripe.api_requestor.APIRequestor(
|
||||
self.requestor = libraries.stripe3.api_requestor.APIRequestor(
|
||||
client=self.http_client)
|
||||
|
||||
def mock_response(self, return_body, return_code, requestor=None,
|
||||
@@ -183,7 +183,7 @@ class APIRequestorRequestTests(StripeUnitTestCase):
|
||||
def _test_encode_naive_datetime(self):
|
||||
stk = []
|
||||
|
||||
libraries.stripe.api_requestor.APIRequestor.encode_datetime(
|
||||
libraries.stripe3.api_requestor.APIRequestor.encode_datetime(
|
||||
stk, 'test', datetime.datetime(2013, 1, 1))
|
||||
|
||||
# Naive datetimes will encode differently depending on your system
|
||||
@@ -286,7 +286,7 @@ class APIRequestorRequestTests(StripeUnitTestCase):
|
||||
|
||||
def test_uses_instance_key(self):
|
||||
key = 'fookey'
|
||||
requestor = libraries.stripe.api_requestor.APIRequestor(key,
|
||||
requestor = libraries.stripe3.api_requestor.APIRequestor(key,
|
||||
client=self.http_client)
|
||||
|
||||
self.mock_response('{}', 200, requestor=requestor)
|
||||
@@ -298,7 +298,7 @@ class APIRequestorRequestTests(StripeUnitTestCase):
|
||||
self.assertEqual(key, used_key)
|
||||
|
||||
def test_passes_api_version(self):
|
||||
libraries.stripe.api_version = 'fooversion'
|
||||
libraries.stripe3.api_version = 'fooversion'
|
||||
|
||||
self.mock_response('{}', 200)
|
||||
|
||||
@@ -309,7 +309,7 @@ class APIRequestorRequestTests(StripeUnitTestCase):
|
||||
|
||||
def test_uses_instance_account(self):
|
||||
account = 'acct_foo'
|
||||
requestor = libraries.stripe.api_requestor.APIRequestor(account=account,
|
||||
requestor = libraries.stripe3.api_requestor.APIRequestor(account=account,
|
||||
client=self.http_client)
|
||||
|
||||
self.mock_response('{}', 200, requestor=requestor)
|
||||
@@ -326,7 +326,7 @@ class APIRequestorRequestTests(StripeUnitTestCase):
|
||||
)
|
||||
|
||||
def test_fails_without_api_key(self):
|
||||
libraries.stripe.api_key = None
|
||||
libraries.stripe3.api_key = None
|
||||
|
||||
self.assertRaises(stripe.error.AuthenticationError,
|
||||
self.requestor.request,
|
||||
@@ -393,8 +393,8 @@ class APIRequestorRequestTests(StripeUnitTestCase):
|
||||
class DefaultClientTests(unittest2.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
libraries.stripe.default_http_client = None
|
||||
libraries.stripe.api_key = 'foo'
|
||||
libraries.stripe3.default_http_client = None
|
||||
libraries.stripe3.api_key = 'foo'
|
||||
|
||||
def test_default_http_client_called(self):
|
||||
hc = Mock(stripe.http_client.HTTPClient)
|
||||
@@ -402,15 +402,15 @@ class DefaultClientTests(unittest2.TestCase):
|
||||
hc.name = 'mockclient'
|
||||
hc.request = Mock(return_value=("{}", 200, {}))
|
||||
|
||||
libraries.stripe.default_http_client = hc
|
||||
libraries.stripe.Charge.list(limit=3)
|
||||
libraries.stripe3.default_http_client = hc
|
||||
libraries.stripe3.Charge.list(limit=3)
|
||||
|
||||
hc.request.assert_called_with(
|
||||
'get', 'https://api.stripe.com/v1/charges?limit=3', ANY, None)
|
||||
|
||||
def tearDown(self):
|
||||
libraries.stripe.api_key = None
|
||||
libraries.stripe.default_http_client = None
|
||||
libraries.stripe3.api_key = None
|
||||
libraries.stripe3.default_http_client = None
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -225,7 +225,7 @@ def serve_resort_get(name="",suffix=""):
|
||||
if not name: return
|
||||
name=name.split("/")[0]
|
||||
domain=gdi(request); user=get_user(request,domain)
|
||||
if security_threat(request,domain): return
|
||||
if security_threat(request,domain): return "security_threat"
|
||||
if not user or (not name.startswith("%s_"%user.k()) and user.k() not in inner_circle): return
|
||||
number=name.split("_")[1]
|
||||
if number not in ["1","2","3","4","5","6","7","8","9","10"]: return
|
||||
|
||||
+9
-5
@@ -4,12 +4,16 @@ builtins:
|
||||
- deferred: on
|
||||
|
||||
#F2/F4: same warmup handler performance [14/10/14]
|
||||
instance_class: F2
|
||||
instance_class: F4_1G
|
||||
automatic_scaling:
|
||||
min_idle_instances: 0
|
||||
max_idle_instances: 1
|
||||
min_pending_latency: 6000ms
|
||||
max_pending_latency: 12000ms
|
||||
min_idle_instances: 0
|
||||
max_idle_instances: 1
|
||||
min_pending_latency: 14000ms
|
||||
# max_pending_latency: 12000ms
|
||||
|
||||
#instance_class: B2
|
||||
#manual_scaling:
|
||||
# instances: 1
|
||||
|
||||
default_expiration: "4d"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user