~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transport_implementations.py

Update non_atomic_put to have a create_parent_dir flag

Show diffs side-by-side

added added

removed removed

Lines of Context:
167
167
        self.check_transport_contents('contents for\nd\n', t, 'd')
168
168
        self.check_transport_contents('', t, 'a')
169
169
 
 
170
        self.assertRaises(NoSuchFile, t.non_atomic_put, 'no/such/path',
 
171
                                       StringIO('contents\n'))
 
172
        # Now test the create_parent flag
 
173
        self.assertRaises(NoSuchFile, t.non_atomic_put, 'dir/a',
 
174
                                       StringIO('contents\n'))
 
175
        self.failIf(t.has('dir/a'))
 
176
        t.non_atomic_put('dir/a', StringIO('contents for dir/a\n'),
 
177
                         create_parent_dir=True)
 
178
        self.check_transport_contents('contents for dir/a\n', t, 'dir/a')
 
179
        
 
180
        # But we still get NoSuchFile if we can't make the parent dir
 
181
        self.assertRaises(NoSuchFile, t.non_atomic_put, 'not/there/a',
 
182
                                       StringIO('contents\n'))
 
183
 
170
184
    def test_put_permissions(self):
171
185
        t = self.get_transport()
172
186