28
28
from bzrlib.errors import (NoSuchFile, FileExists,
29
30
TransportNotPossible, ConnectionError)
30
31
from bzrlib.tests import TestCaseInTempDir, TestSkipped
31
32
from bzrlib.transport import memory, urlescape
800
802
transport = transport.clone('isolated')
801
803
paths = set(transport.iter_files_recursive())
802
804
self.assertEqual(set(['dir/foo', 'dir/bar', 'bar']), paths)
806
def test_connect_twice_is_same_content(self):
807
# check that our server (whatever it is) is accessable reliably
808
# via get_transport and multiple connections share content.
809
transport = self.get_transport()
810
if transport.is_readonly():
812
transport.put('foo', StringIO('bar'))
813
transport2 = self.get_transport()
814
self.check_transport_contents('bar', transport2, 'foo')
815
# its base should be usable.
816
transport2 = bzrlib.transport.get_transport(transport.base)
817
self.check_transport_contents('bar', transport2, 'foo')
819
# now opening at a relative url should give use a sane result:
820
transport.mkdir('newdir')
821
transport2 = bzrlib.transport.get_transport(transport.base + "newdir")
822
transport2 = transport2.clone('..')
823
self.check_transport_contents('bar', transport2, 'foo')
825
def test_lock_write(self):
826
transport = self.get_transport()
827
if transport.is_readonly():
828
self.assertRaises(TransportNotPossible, transport.lock_write, 'foo')
830
transport.put('lock', StringIO())
831
lock = transport.lock_write('lock')
832
# TODO make this consistent on all platforms:
833
# self.assertRaises(LockError, transport.lock_write, 'lock')
836
def test_lock_read(self):
837
transport = self.get_transport()
838
if transport.is_readonly():
839
file('lock', 'w').close()
841
transport.put('lock', StringIO())
842
lock = transport.lock_read('lock')
843
# TODO make this consistent on all platforms:
844
# self.assertRaises(LockError, transport.lock_read, 'lock')