~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transport_implementations.py

  • Committer: John Arbash Meinel
  • Date: 2006-08-09 14:43:27 UTC
  • mto: This revision was merged to the branch mainline in revision 1912.
  • Revision ID: john@arbash-meinel.com-20060809144327-d604af2edf646794
Clean up and write tests for permissions. Now we use fstat which should be cheap, and lets us check the permissions and the file size

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
import stat
26
26
import sys
27
27
 
 
28
from bzrlib import (
 
29
    osutils,
 
30
    urlutils,
 
31
    )
28
32
from bzrlib.errors import (DirectoryNotEmpty, NoSuchFile, FileExists,
29
33
                           LockError, PathError,
30
34
                           TransportNotPossible, ConnectionError,
34
38
from bzrlib.tests.test_transport import TestTransportImplementation
35
39
from bzrlib.transport import memory
36
40
import bzrlib.transport
37
 
import bzrlib.urlutils as urlutils
38
41
 
39
42
 
40
43
def _append(fn, txt):
160
163
        self.assertTransportMode(t, 'mode400', 0400)
161
164
        t.put_multi([('mmode644', StringIO('text\n'))], mode=0644)
162
165
        self.assertTransportMode(t, 'mmode644', 0644)
 
166
 
 
167
        # The default permissions should be based on the current umask
 
168
        umask = osutils.get_umask()
 
169
        t.put('nomode', StringIO('test text\n'), mode=None)
 
170
        self.assertTransportMode(t, 'nomode', 0666 & ~umask)
163
171
        
164
172
    def test_mkdir(self):
165
173
        t = self.get_transport()
224
232
        self.assertTransportMode(t, 'dmode777', 0777)
225
233
        t.mkdir('dmode700', mode=0700)
226
234
        self.assertTransportMode(t, 'dmode700', 0700)
227
 
        # TODO: jam 20051215 test mkdir_multi with a mode
228
235
        t.mkdir_multi(['mdmode755'], mode=0755)
229
236
        self.assertTransportMode(t, 'mdmode755', 0755)
230
237
 
 
238
        # Default mode should be based on umask
 
239
        umask = osutils.get_umask()
 
240
        t.mkdir('dnomode', mode=None)
 
241
        self.assertTransportMode(t, 'dnomode', 0777 & ~umask)
 
242
 
231
243
    def test_copy_to(self):
232
244
        # FIXME: test:   same server to same server (partly done)
233
245
        # same protocol two servers