Skip to content

Commit

Permalink
recurly: AccountSubscriptions resource should inherit from Subscriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
javimb committed May 4, 2015
1 parent dbf02ae commit 9f27f9b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 2 additions & 3 deletions libsaas/services/recurly/subscriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ def get(self, state='live', cursor=None, per_page=None):
or "past_due". A subscription will belong to more than one state.
:vartype state: str
"""
params = base.get_params(('cursor', 'per_page'), locals())
params['state'] = state
params = base.get_params(None, locals())
request = http.Request('GET', self.get_url(), params)

return request, parsers.parse_xml
Expand Down Expand Up @@ -104,7 +103,7 @@ def postpone(self, next_renewal_date):
return request, parsers.parse_empty


class AccountSubscriptions(SubscriptionsBase):
class AccountSubscriptions(Subscriptions):

def create(self, *args, **kwargs):
raise base.MethodNotSupported()
Expand Down
7 changes: 6 additions & 1 deletion test/test_recurly.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ def test_accounts(self):
self.expect('GET', '/accounts/3/subscriptions')

self.service.account(3).subscriptions().get(per_page=23)
self.expect('GET', '/accounts/3/subscriptions', {'per_page': 23})
self.expect(
'GET', '/accounts/3/subscriptions',
{'per_page': 23, 'state': 'live'})

self.service.account(3).subscriptions().get(state='active')
self.expect('GET', '/accounts/3/subscriptions', {'state': 'active'})

self.service.account(3).billing_info().get()
self.expect('GET', '/accounts/3/billing_info')
Expand Down

0 comments on commit 9f27f9b

Please sign in to comment.