Skip to content

Commit 4158e8b

Browse files
committed
Updated test
Put the decode on the test, removed the name for clarity
1 parent 3dcc614 commit 4158e8b

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

tests/unit/test_client.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import simplejson as json
1+
import json
22
from tests.integration.test_base import QuickbooksUnitTestCase
33

44
try:
@@ -7,7 +7,7 @@
77
from unittest.mock import patch, mock_open
88

99
from quickbooks.exceptions import QuickbooksException, SevereException, AuthorizationException
10-
from quickbooks import client
10+
from quickbooks import client, mixins
1111
from quickbooks.objects.salesreceipt import SalesReceipt
1212

1313

@@ -142,7 +142,7 @@ def test_get_single_object(self, make_req):
142142

143143
@patch('quickbooks.client.QuickBooks.process_request')
144144
def test_make_request(self, process_request):
145-
process_request.return_value = MockResponseSimpleJson()
145+
process_request.return_value = MockResponseJson()
146146

147147
qb_client = client.QuickBooks()
148148
qb_client.company_id = "1234"
@@ -221,7 +221,7 @@ def test_download_pdf_not_authorized(self, process_request):
221221
@patch('quickbooks.client.QuickBooks.process_request')
222222
def test_make_request_file_closed(self, process_request):
223223
file_path = '/path/to/file.txt'
224-
process_request.return_value = MockResponseSimpleJson()
224+
process_request.return_value = MockResponseJson()
225225
with patch('builtins.open', mock_open(read_data=b'file content')) as mock_file:
226226
qb_client = client.QuickBooks(auth_client=self.auth_client)
227227
qb_client.make_request('POST',
@@ -254,14 +254,14 @@ def json(self):
254254
def content(self):
255255
return ''
256256

257-
class MockResponseSimpleJson:
257+
class MockResponseJson:
258258
def __init__(self, json_data=None, status_code=200):
259259
self.json_data = json_data or {}
260260
self.status_code = status_code
261261

262262
@property
263263
def text(self):
264-
return json.dumps(self.json_data) # Ensure this uses simplejson if necessary
264+
return json.dumps(self.json_data, cls=mixins.DecimalEncoder)
265265

266266
def json(self):
267267
return self.json_data

0 commit comments

Comments
 (0)