76
79
set_test_transport_to_sftp(self)
79
class SFTPLockTests (TestCaseWithSFTPServer):
82
class SFTPLockTests(TestCaseWithSFTPServer):
81
84
def test_sftp_locks(self):
82
85
from bzrlib.errors import LockError
459
462
self.assertAlmostEqual(t2 - t1, 100 + 7)
465
class Test_SFTPReadvHelper(tests.TestCase):
467
def assertGetRequests(self, expected_requests, offsets):
468
helper = _mod_sftp._SFTPReadvHelper(offsets, 'artificial_test')
469
self.assertEqual(expected_requests, helper._get_requests())
471
def test__get_requests(self):
472
# Small single requests become a single readv request
473
self.assertGetRequests([(0, 100)], [(0, 20), (30, 50), (20, 10),
475
# Non-contiguous ranges are given as multiple requests
476
self.assertGetRequests([(0, 20), (30, 50)],
477
[(10, 10), (30, 20), (0, 10), (50, 30)])
478
# Ranges larger than _max_request_size (32kB) are broken up into
479
# multiple requests, even if it actually spans multiple logical
481
self.assertGetRequests([(0, 32768), (32768, 32768), (65536, 464)],
482
[(0, 40000), (40000, 100), (40100, 1900),