Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bdabd34

Browse files
committed
Added integration tests for taxrate.
1 parent d25e892 commit bdabd34

File tree

4 files changed

+31
-3
lines changed

4 files changed

+31
-3
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Changelog
1515
* Fixed issues with default values on Term.
1616
* Fixed issues with default values on TaxService and TaxRateDetails.
1717
* Fixed issues that prevented save from working on TaxService.
18+
* Removed unsupported save method from TaxRate.
1819

1920
* 0.4.0 (June 15, 2016)
2021
* Added a way of disconnecting a Quickbooks Account to client.

quickbooks/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class QuickBooks(object):
5555
"Department", "Deposit", "Employee", "Estimate", "Invoice",
5656
"Item", "JournalEntry", "Payment", "PaymentMethod",
5757
"Purchase", "PurchaseOrder", "RefundReceipt",
58-
"SalesReceipt", "TaxService/Taxcode", "TaxRate", "Term",
58+
"SalesReceipt", "Taxcode", "TaxService/Taxcode", "TaxRate", "Term",
5959
"TimeActivity", "Transfer", "Vendor", "VendorCredit"
6060
]
6161

quickbooks/objects/taxrate.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
from six import python_2_unicode_compatible
2-
from .base import QuickbooksManagedObject, QuickbooksTransactionEntity, Ref
2+
3+
from quickbooks.mixins import ListMixin, ReadMixin
4+
from .base import QuickbooksTransactionEntity, Ref, QuickbooksBaseObject
35

46

57
@python_2_unicode_compatible
6-
class TaxRate(QuickbooksManagedObject, QuickbooksTransactionEntity):
8+
class TaxRate(QuickbooksTransactionEntity, QuickbooksBaseObject, ReadMixin, ListMixin):
79
"""
810
QBO definition: A TaxRate object represents rate applied to calculate tax liability. Use the TaxService
911
entity to create a taxrate.
@@ -17,6 +19,8 @@ class TaxRate(QuickbooksManagedObject, QuickbooksTransactionEntity):
1719

1820
def __init__(self):
1921
super(TaxRate, self).__init__()
22+
23+
# All values are readonly - TaxRates cannot be created or modified with the TaxRate object
2024
self.Name = ""
2125
self.Description = ""
2226
self.RateValue = 0

tests/integration/test_taxrate.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import os
2+
import unittest
3+
4+
from quickbooks.client import QuickBooks
5+
from quickbooks.objects.taxrate import TaxRate
6+
7+
8+
class TaxRateTest(unittest.TestCase):
9+
def setUp(self):
10+
self.qb_client = QuickBooks(
11+
sandbox=True,
12+
consumer_key=os.environ.get('CONSUMER_KEY'),
13+
consumer_secret=os.environ.get('CONSUMER_SECRET'),
14+
access_token=os.environ.get('ACCESS_TOKEN'),
15+
access_token_secret=os.environ.get('ACCESS_TOKEN_SECRET'),
16+
company_id=os.environ.get('COMPANY_ID')
17+
)
18+
19+
def test_read(self):
20+
tax_rates = TaxRate.all(max_results=1, qb=self.qb_client)
21+
22+
self.assertEquals(len(tax_rates), 1)
23+

0 commit comments

Comments
 (0)