Skip to content

Commit 85e0578

Browse files
committed
Fixed issue with send mixin.
1 parent 4a66300 commit 85e0578

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

quickbooks/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,9 +329,9 @@ def batch_operation(self, request_body):
329329

330330
return results
331331

332-
def misc_operation(self, end_point, request_body):
332+
def misc_operation(self, end_point, request_body, content_type='application/json'):
333333
url = "{0}/company/{1}/{2}".format(self.api_url, self.company_id, end_point)
334-
results = self.post(url, request_body)
334+
results = self.post(url, request_body, content_type)
335335

336336
return results
337337

quickbooks/mixins.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,12 @@ def send(self, qb=None, send_to=None):
104104
if not qb:
105105
qb = QuickBooks()
106106

107-
end_point = "{0}/{1}/send".format(self.qbo_object_name, self.Id)
107+
end_point = "{0}/{1}/send".format(self.qbo_object_name.lower(), self.Id)
108108

109109
if send_to:
110110
end_point = "{0}?sendTo={1}".format(end_point, send_to)
111111

112-
results = qb.misc_operation(end_point, None)
112+
results = qb.misc_operation(end_point, None, 'application/octet-stream')
113113

114114
return results
115115

tests/unit/test_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def test_misc_operation(self, post):
108108
qb_client.misc_operation("end_point", "request_body")
109109

110110
url = "https://sandbox-quickbooks.api.intuit.com/v3/company/update_company_id/end_point"
111-
post.assert_called_with(url, "request_body")
111+
post.assert_called_with(url, "request_body", 'application/json')
112112

113113
@patch('quickbooks.client.QuickBooks.post')
114114
def test_create_object(self, post):

tests/unit/test_mixins.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,12 +402,12 @@ def test_send(self, mock_misc_op):
402402
invoice.Id = 2
403403
invoice.send(qb=self.qb_client)
404404

405-
mock_misc_op.assert_called_with("Invoice/2/send", None)
405+
mock_misc_op.assert_called_with("invoice/2/send", None, 'application/octet-stream')
406406

407407
@patch('quickbooks.mixins.QuickBooks.misc_operation')
408408
def test_send_with_send_to_email(self, mock_misc_op):
409409
invoice = Invoice()
410410
invoice.Id = 2
411411
invoice.send(qb=self.qb_client, send_to="test@email.com")
412412

413-
mock_misc_op.assert_called_with("Invoice/2/send?sendTo=test@email.com", None)
413+
mock_misc_op.assert_called_with("invoice/2/send?sendTo=test@email.com", None, 'application/octet-stream')

0 commit comments

Comments
 (0)