Skip to content

Commit

Permalink
Merge pull request #77 from recurly/coupon-invoice-description
Browse files Browse the repository at this point in the history
Adding invoice_description specs
  • Loading branch information
dickfickling committed Jun 6, 2014
2 parents 076b9e6 + 3228657 commit 385c773
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## Version 2.2.1 June 6, 2014
- Added tests for `invoice_description`

## Version 2.2.0 May 14, 2014

- Added subscription preview: `subscription.preview()`
Expand Down
3 changes: 2 additions & 1 deletion recurly/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"""


__version__ = '2.2.0'
__version__ = '2.2.1'

BASE_URI = 'https://%s.recurly.com/v2/'
"""The API endpoint to send requests to."""
Expand Down Expand Up @@ -279,6 +279,7 @@ class Coupon(Resource):
'discount_percent',
'discount_in_cents',
'redeem_by_date',
'invoice_description',
'single_use',
'applies_for_months',
'max_redemptions',
Expand Down
14 changes: 8 additions & 6 deletions tests/fixtures/coupon/created.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ Content-Type: application/xml; charset=utf-8

<?xml version="1.0" encoding="UTF-8"?>
<coupon>
<coupon_code>couponmock</coupon_code>
<name>Nice Coupon</name>
<discount_in_cents>
<USD type="integer">1000</USD>
</discount_in_cents>
<hosted_description>Nice Description</hosted_description>
<coupon_code>couponmock</coupon_code>
<name>Nice Coupon</name>
<discount_in_cents>
<USD type="integer">1000</USD>
</discount_in_cents>
<invoice_description>Invoice description</invoice_description>
<hosted_description>Nice Description</hosted_description>
</coupon>

HTTP/1.1 201 Created
Expand All @@ -24,6 +25,7 @@ Location: https://api.recurly.com/v2/coupons/couponmock
<name>Nice Coupon</name>
<discount_type>dollars</discount_type>
<hosted_description>Nice Description</hosted_description>
<invoice_description>Invoice description</invoice_description>
<discount_percent nil="nil"></discount_percent>
<redeem_by_date nil="nil"></redeem_by_date>
<single_use type="boolean">false</single_use>
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/coupon/exists.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Content-Type: application/xml; charset=utf-8
<discount_in_cents>
<USD type="integer">1000</USD>
</discount_in_cents>
<invoice_description>Invoice description</invoice_description>
<plan_codes type="array">
</plan_codes>
<a name="redeem" href="https://api.recurly.com/v2/coupons/couponmock/redeem" method="put"/>
Expand Down
2 changes: 2 additions & 0 deletions tests/fixtures/coupon/plan-coupon-created.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Content-Type: application/xml; charset=utf-8
<discount_in_cents>
<USD type="integer">1000</USD>
</discount_in_cents>
<invoice_description>Invoice description</invoice_description>
<applies_to_all_plans type="boolean">false</applies_to_all_plans>
<plan_codes type="array">
<plan_code>basicplan</plan_code>
Expand All @@ -36,6 +37,7 @@ Location: https://api.recurly.com/v2/coupons/plancouponmock
<discount_in_cents>
<USD type="integer">1000</USD>
</discount_in_cents>
<invoice_description>Invoice description</invoice_description>
<plan_codes type="array">
<plan_code>basicplan</plan_code>
</plan_codes>
Expand Down
5 changes: 4 additions & 1 deletion tests/test_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,8 @@ def test_coupon(self):
coupon_code=coupon_code,
name='Nice Coupon',
discount_in_cents=Money(1000),
hosted_description="Nice Description"
hosted_description='Nice Description',
invoice_description='Invoice description'
)
with self.mock_request('coupon/created.xml'):
coupon.save()
Expand All @@ -384,6 +385,7 @@ def test_coupon(self):
same_coupon = Coupon.get(coupon_code)
self.assertEqual(same_coupon.coupon_code, coupon_code)
self.assertEqual(same_coupon.name, 'Nice Coupon')
self.assertEqual(same_coupon.invoice_description, 'Invoice description')
discount = same_coupon.discount_in_cents
self.assertEqual(discount['USD'], 1000)
self.assertTrue('USD' in discount)
Expand Down Expand Up @@ -475,6 +477,7 @@ def test_coupon(self):
coupon_code='plancoupon%s' % self.test_id,
name='Plan Coupon',
discount_in_cents=Money(1000),
invoice_description='Invoice description',
applies_to_all_plans=False,
plan_codes=('basicplan',),
)
Expand Down

0 comments on commit 385c773

Please sign in to comment.