Skip to content

Commit

Permalink
Adding invoice_description specs
Browse files Browse the repository at this point in the history
  • Loading branch information
csmb committed May 30, 2014
1 parent 076b9e6 commit c4a63f5
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 7 deletions.
1 change: 1 addition & 0 deletions recurly/__init__.py
Original file line number Diff line number Diff line change
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 c4a63f5

Please sign in to comment.