File tree Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Original file line number Diff line number Diff line change 1313# limitations under the License.
1414
1515import io
16+ import os
17+
18+ from tempfile import NamedTemporaryFile
19+
1620
1721import requests_mock
1822
@@ -68,8 +72,25 @@ def test_successful_conversion(self):
6872
6973 pdf_fo = io .BytesIO (b'pdf content' )
7074 c = Client ('fake_key' )
71- s = c .dump (pdf_fo , 'csv' )
72- self .assertEqual (b'xlsx output' , consume (s ))
75+
76+ with NamedTemporaryFile (suffix = "test.pdf" ) as tf :
77+ filename = tf .name
78+
79+ tf .write (b"Hello world" )
80+ tf .file .close ()
81+
82+ filename_out = filename .replace (".pdf" , ".xlsx" )
83+
84+ try :
85+ s = c .convert (filename , filename_out )
86+
87+ with open (filename_out ) as fd :
88+ self .assertEqual (fd .read (), "xlsx output" )
89+ finally :
90+ try :
91+ os .unlink (filename_out )
92+ except OSError :
93+ pass
7394
7495 def test_different_api_url (self ):
7596 with requests_mock .mock () as m :
You can’t perform that action at this time.
0 commit comments