From 872b354377723dc34ed1fc7ad36ef4183c699d75 Mon Sep 17 00:00:00 2001 From: Olivier Bellone Date: Wed, 18 Oct 2017 11:03:21 +0200 Subject: [PATCH] Make operations list explicit --- stripe/resource.py | 12 +++++++++--- stripe/test/resources/test_api_resource.py | 5 ++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/stripe/resource.py b/stripe/resource.py index 719c1c279..b6a128c88 100644 --- a/stripe/resource.py +++ b/stripe/resource.py @@ -110,7 +110,7 @@ def nested_resource_class_methods(resource, path=None, operations=None): if path is None: path = "%ss" % resource if operations is None: - operations = ['create', 'retrieve', 'update', 'delete', 'list'] + raise ValueError("operations list required") def wrapper(cls): def nested_resource_url(cls, id, nested_id=None): @@ -615,7 +615,10 @@ def delete(self, **params): # API objects -@nested_resource_class_methods('external_account') +@nested_resource_class_methods( + 'external_account', + operations=['create', 'retrieve', 'update', 'delete', 'list'] +) @nested_resource_class_methods('login_link', operations=['create']) class Account(CreateableAPIResource, ListableAPIResource, UpdateableAPIResource, DeletableAPIResource): @@ -865,7 +868,10 @@ def close(self, idempotency_key=None): return self -@nested_resource_class_methods('source') +@nested_resource_class_methods( + 'source', + operations=['create', 'retrieve', 'update', 'delete', 'list'] +) class Customer(CreateableAPIResource, UpdateableAPIResource, ListableAPIResource, DeletableAPIResource): diff --git a/stripe/test/resources/test_api_resource.py b/stripe/test/resources/test_api_resource.py index 40ed57e30..0db30eda6 100644 --- a/stripe/test/resources/test_api_resource.py +++ b/stripe/test/resources/test_api_resource.py @@ -119,7 +119,10 @@ def test_retrieve(self): class NestedResourceClassMethodsTests(StripeApiTestCase): - @stripe.resource.nested_resource_class_methods('nested') + @stripe.resource.nested_resource_class_methods( + 'nested', + operations=['create', 'retrieve', 'update', 'delete', 'list'] + ) class MainResource(stripe.resource.APIResource): pass