~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_transport.py

(vila) Forbid more operations on ReadonlyTransportDecorator (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2011 Canonical Ltd
 
1
# Copyright (C) 2005-2011, 2015 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
630
630
    def test_opening_a_file_stream_can_set_mode(self):
631
631
        t = self.get_transport()
632
632
        if t.is_readonly():
 
633
            self.assertRaises((TransportNotPossible, NotImplementedError),
 
634
                              t.open_write_stream, 'foo')
633
635
            return
634
636
        if not t._can_roundtrip_unix_modebits():
635
637
            # Can't roundtrip, so no need to run this test
636
638
            return
 
639
 
637
640
        def check_mode(name, mode, expected):
638
641
            handle = t.open_write_stream(name, mode=mode)
639
642
            handle.close()
921
924
    def test_rename_dir_succeeds(self):
922
925
        t = self.get_transport()
923
926
        if t.is_readonly():
924
 
            raise TestSkipped("transport is readonly")
 
927
            self.assertRaises((TransportNotPossible, NotImplementedError),
 
928
                              t.rename, 'foo', 'bar')
 
929
            return
925
930
        t.mkdir('adir')
926
931
        t.mkdir('adir/asubdir')
927
932
        t.rename('adir', 'bdir')
932
937
        """Attempting to replace a nonemtpy directory should fail"""
933
938
        t = self.get_transport()
934
939
        if t.is_readonly():
935
 
            raise TestSkipped("transport is readonly")
 
940
            self.assertRaises((TransportNotPossible, NotImplementedError),
 
941
                              t.rename, 'foo', 'bar')
 
942
            return
936
943
        t.mkdir('adir')
937
944
        t.mkdir('adir/asubdir')
938
945
        t.mkdir('bdir')