Skip to content

Commit 6e510c7

Browse files
committed
Added tests and unicode to Payment.
1 parent 0d70e5f commit 6e510c7

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

quickbooks/objects/payment.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ def __init__(self):
1212
self.LineNum = 0
1313
self.Description = ""
1414

15+
def __unicode__(self):
16+
return "[{0}] {1} {2}".format(self.LineNum, self.Description, self.Amount)
17+
1518

1619
class Payment(QuickbooksManagedObject):
1720
"""
@@ -52,3 +55,5 @@ def __init__(self):
5255
self.PaymentMethodRef = None
5356
self.Line = []
5457

58+
def __unicode__(self):
59+
return self.TotalAmt

tests/unit/objects/test_payment.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import unittest
2+
3+
from quickbooks.objects.payment import PaymentLine, Payment
4+
5+
6+
class PaymentLineTests(unittest.TestCase):
7+
def test_unicode(self):
8+
memo_line = PaymentLine()
9+
memo_line.LineNum = 1
10+
memo_line.Description = "Product Description"
11+
memo_line.Amount = 100
12+
13+
self.assertEquals(memo_line.__unicode__(), "[1] Product Description 100")
14+
15+
16+
class PaymentTests(unittest.TestCase):
17+
def test_unicode(self):
18+
credit_memo = Payment()
19+
credit_memo.TotalAmt = 1000
20+
21+
self.assertEquals(credit_memo.__unicode__(), 1000)

0 commit comments

Comments
 (0)