Skip to content

Commit beab272

Browse files
committed
Update tests and fix issues
1 parent 0145226 commit beab272

File tree

7 files changed

+25
-16
lines changed

7 files changed

+25
-16
lines changed

CHANGELOG.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
Changelog
22
=========
33

4+
* 0.9.11 (April 15, 2025)
5+
* Add CostRate to TimeActivity
6+
* Fix retrieval of Item SKU field
7+
* Added support for attaching files using byte streams
8+
* Default minor version to minimum supported version
9+
* Fix incompatibility issues with setuptools
10+
411
* 0.9.11 (February 10, 2025)
512
* Add warning for unsupported minorversion
613
* Fix issue with new versions of jsonEncoder

quickbooks/client.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,15 +242,13 @@ def make_request(self, request_type, url, request_body=None, content_type='appli
242242
def get(self, *args, **kwargs):
243243
if 'params' not in kwargs:
244244
kwargs['params'] = {}
245-
if 'minorversion' not in kwargs['params']:
246-
kwargs['params']['minorversion'] = self.MINIMUM_MINOR_VERSION
245+
247246
return self.make_request('GET', *args, **kwargs)
248247

249248
def post(self, *args, **kwargs):
250249
if 'params' not in kwargs:
251250
kwargs['params'] = {}
252-
if 'minorversion' not in kwargs['params']:
253-
kwargs['params']['minorversion'] = self.MINIMUM_MINOR_VERSION
251+
254252
return self.make_request('POST', *args, **kwargs)
255253

256254
def process_request(self, request_type, url, headers="", params="", data=""):

quickbooks/objects/employee.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Employee(QuickbooksManagedObject, QuickbooksTransactionEntity):
1717

1818
def __init__(self):
1919
super(Employee, self).__init__()
20-
self.SSN = ""
20+
self.SSN = None
2121

2222
self.GivenName = ""
2323
self.FamilyName = ""
@@ -29,9 +29,9 @@ def __init__(self):
2929
self.Title = ""
3030
self.BillRate = 0
3131
self.CostRate = 0
32-
self.BirthDate = ""
32+
self.BirthDate = None
3333
self.Gender = None
34-
self.HiredDate = ""
34+
self.HiredDate = None
3535
self.ReleasedDate = ""
3636
self.Active = True
3737
self.Organization = False

tests/integration/test_account.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def test_create(self):
2424
account.AccountSubType = "CashOnHand"
2525

2626
created_account = account.save(qb=self.qb_client)
27-
27+
2828
# Verify the save was successful
2929
self.assertIsNotNone(created_account)
3030
self.assertIsNotNone(created_account.Id)

tests/integration/test_base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def setUp(self):
2020
auth_client=self.auth_client,
2121
refresh_token=os.environ.get('REFRESH_TOKEN'),
2222
company_id=os.environ.get('COMPANY_ID'),
23+
minorversion=75
2324
)
2425

2526
self.qb_client.sandbox = True
@@ -40,6 +41,7 @@ def setUp(self):
4041
# auth_client=self.auth_client,
4142
refresh_token='REFRESH_TOKEN',
4243
company_id='COMPANY_ID',
44+
minorversion=75
4345
)
4446

4547
self.qb_client.sandbox = True

tests/integration/test_employee.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
from datetime import datetime
1+
from datetime import datetime, date
22

33
from quickbooks.objects.base import Address, PhoneNumber
44
from quickbooks.objects.employee import Employee
55
from tests.integration.test_base import QuickbooksTestCase
6+
from quickbooks.helpers import qb_date_format
67

78

89
class EmployeeTest(QuickbooksTestCase):
910
def test_create(self):
1011
employee = Employee()
11-
employee.SSN = "444-55-6666"
12+
employee.SSN = None
1213
employee.GivenName = "John"
14+
employee.HiredDate = qb_date_format(date(2020, 7, 22))
1315
employee.FamilyName = "Smith {0}".format(datetime.now().strftime('%d%H%M%S'))
1416

1517
employee.PrimaryAddr = Address()
@@ -19,13 +21,13 @@ def test_create(self):
1921
employee.PrimaryAddr.PostalCode = "93242"
2022

2123
employee.PrimaryPhone = PhoneNumber()
22-
employee.PrimaryPhone.FreeFormNumber = "408-525-1234"
24+
employee.PrimaryPhone.FreeFormNumber = "4085251234"
25+
2326
employee.save(qb=self.qb_client)
2427

2528
query_employee = Employee.get(employee.Id, qb=self.qb_client)
2629

2730
self.assertEqual(query_employee.Id, employee.Id)
28-
self.assertEqual(query_employee.SSN, "XXX-XX-XXXX")
2931
self.assertEqual(query_employee.GivenName, employee.GivenName)
3032
self.assertEqual(query_employee.FamilyName, employee.FamilyName)
3133
self.assertEqual(query_employee.PrimaryAddr.Line1, employee.PrimaryAddr.Line1)

tests/unit/test_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def test_update_object_with_request_id(self, make_req):
123123
qb_client.update_object("Customer", "request_body", request_id="123")
124124

125125
url = "https://sandbox-quickbooks.api.intuit.com/v3/company/1234/customer"
126-
make_req.assert_called_with("POST", url, "request_body", file_path=None, file_bytes=None, request_id="123", params={'minorversion': client.QuickBooks.MINIMUM_MINOR_VERSION})
126+
make_req.assert_called_with("POST", url, "request_body", file_path=None, file_bytes=None, request_id="123", params={})
127127

128128
@patch('quickbooks.client.QuickBooks.get')
129129
def test_get_current_user(self, get):
@@ -141,7 +141,7 @@ def test_get_report(self, make_req):
141141

142142
qb_client.get_report("profitandloss", {1: 2})
143143
url = "https://sandbox-quickbooks.api.intuit.com/v3/company/1234/reports/profitandloss"
144-
expected_params = {1: 2, 'minorversion': client.QuickBooks.MINIMUM_MINOR_VERSION}
144+
expected_params = {1: 2}
145145
make_req.assert_called_with("GET", url, params=expected_params)
146146

147147
@patch('quickbooks.client.QuickBooks.make_request')
@@ -151,7 +151,7 @@ def test_get_single_object(self, make_req):
151151

152152
qb_client.get_single_object("test", 1)
153153
url = "https://sandbox-quickbooks.api.intuit.com/v3/company/1234/test/1"
154-
make_req.assert_called_with("GET", url, {}, params={'minorversion': client.QuickBooks.MINIMUM_MINOR_VERSION})
154+
make_req.assert_called_with("GET", url, {}, params={})
155155

156156
@patch('quickbooks.client.QuickBooks.make_request')
157157
def test_get_single_object_with_params(self, make_req):
@@ -160,7 +160,7 @@ def test_get_single_object_with_params(self, make_req):
160160

161161
qb_client.get_single_object("test", 1, params={'param':'value'})
162162
url = "https://sandbox-quickbooks.api.intuit.com/v3/company/1234/test/1"
163-
make_req.assert_called_with("GET", url, {}, params={'param':'value', 'minorversion': client.QuickBooks.MINIMUM_MINOR_VERSION})
163+
make_req.assert_called_with("GET", url, {}, params={'param':'value'})
164164

165165
@patch('quickbooks.client.QuickBooks.process_request')
166166
def test_make_request(self, process_request):

0 commit comments

Comments
 (0)