|
|
@ -101,15 +101,15 @@ class OptionalIntTest(testlib.TestCase):
|
|
|
|
|
|
|
|
|
|
|
|
class FetchFileTest(ConnectionMixin, testlib.TestCase):
|
|
|
|
class FetchFileTest(ConnectionMixin, testlib.TestCase):
|
|
|
|
def test_success(self):
|
|
|
|
def test_success(self):
|
|
|
|
with tempfile.NamedTemporaryFile(prefix='mitotest') as ifp, \
|
|
|
|
with tempfile.NamedTemporaryFile(prefix='mitotest') as ifp:
|
|
|
|
tempfile.NamedTemporaryFile(prefix='mitotest') as ofp:
|
|
|
|
with tempfile.NamedTemporaryFile(prefix='mitotest') as ofp:
|
|
|
|
ifp.write(b'x' * (1048576 * 4))
|
|
|
|
ifp.write(b'x' * (1048576 * 4))
|
|
|
|
ifp.flush()
|
|
|
|
ifp.flush()
|
|
|
|
ifp.seek(0)
|
|
|
|
ifp.seek(0)
|
|
|
|
|
|
|
|
|
|
|
|
self.conn.fetch_file(ifp.name, ofp.name)
|
|
|
|
self.conn.fetch_file(ifp.name, ofp.name)
|
|
|
|
# transfer_file() uses os.rename rather than direct data overwrite,
|
|
|
|
# transfer_file() uses os.rename rather than direct data
|
|
|
|
# so we must reopen.
|
|
|
|
# overwrite, so we must reopen.
|
|
|
|
with open(ofp.name, 'rb') as fp:
|
|
|
|
with open(ofp.name, 'rb') as fp:
|
|
|
|
self.assertEquals(ifp.read(), fp.read())
|
|
|
|
self.assertEquals(ifp.read(), fp.read())
|
|
|
|
|
|
|
|
|
|
|
|