Skip to content

Commit decaa42

Browse files
committed
Test download_pdf returns requests content
1 parent cfcc3df commit decaa42

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/unit/test_client.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,11 @@ def test_download_pdf(self, qb_session):
230230
"GET", url, True, "1234",
231231
headers={'Content-Type': 'application/pdf', 'Accept': 'application/pdf, application/json'})
232232

233+
qb_session.request.return_value = MockPdfResponse()
234+
response = receipt.download_pdf()
235+
236+
self.assertEqual(response, 'sample pdf content')
237+
233238
def test_download_nonexistent_pdf(self):
234239
receipt = SalesReceipt()
235240
receipt.Id = 666
@@ -240,3 +245,14 @@ class MockResponse(object):
240245
@property
241246
def text(self):
242247
return "oauth_token_secret=secretvalue&oauth_callback_confirmed=true&oauth_token=tokenvalue"
248+
249+
250+
class MockPdfResponse(object):
251+
@property
252+
def status_code(self):
253+
import httplib
254+
return httplib.OK
255+
256+
@property
257+
def content(self):
258+
return "sample pdf content"

0 commit comments

Comments
 (0)