Skip to content

Commit

Permalink
[codegen] Update API Resources (#607)
Browse files Browse the repository at this point in the history
* Codegen for openapi c806fa1

* Write tests
  • Loading branch information
ob-stripe committed Aug 13, 2019
1 parent 95166ac commit 8f6fbf3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions stripe/api_resources/subscription_item.py
Expand Up @@ -4,8 +4,10 @@
from stripe.api_resources.abstract import DeletableAPIResource
from stripe.api_resources.abstract import ListableAPIResource
from stripe.api_resources.abstract import UpdateableAPIResource
from stripe.api_resources.abstract import nested_resource_class_methods


@nested_resource_class_methods("usage_record", operations=["create"])
class SubscriptionItem(
CreateableAPIResource,
DeletableAPIResource,
Expand Down
15 changes: 15 additions & 0 deletions tests/api_resources/test_subscription_item.py
Expand Up @@ -64,3 +64,18 @@ def test_can_delete(self, request_mock):
"delete", "/v1/subscription_items/%s" % TEST_RESOURCE_ID
)
assert resource.deleted is True


class TestUsageRecords(object):
def test_is_creatable(self, request_mock):
resource = stripe.SubscriptionItem.create_usage_record(
TEST_RESOURCE_ID,
quantity=5000,
timestamp=1524182400,
action="increment",
)
request_mock.assert_requested(
"post",
"/v1/subscription_items/%s/usage_records" % TEST_RESOURCE_ID,
)
assert isinstance(resource, stripe.UsageRecord)

0 comments on commit 8f6fbf3

Please sign in to comment.