~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_permissions.py

  • Committer: Alexander Belchenko
  • Date: 2006-07-31 16:12:57 UTC
  • mto: (1711.2.111 jam-integration)
  • mto: This revision was merged to the branch mainline in revision 1906.
  • Revision ID: bialix@ukr.net-20060731161257-91a231523255332c
new official bzr.ico

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005 Canonical Ltd
 
1
# Copyright (C) 2005 by Canonical Ltd
2
2
# -*- coding: utf-8 -*-
3
3
#
4
4
# This program is free software; you can redistribute it and/or modify
33
33
import os
34
34
import sys
35
35
import stat
36
 
from cStringIO import StringIO
37
 
import urllib
 
36
from StringIO import StringIO
38
37
 
39
38
from bzrlib.branch import Branch
40
39
from bzrlib.bzrdir import BzrDir
73
72
        test.assertTransportMode(t, base, dir_mode)
74
73
    for root, dirs, files in os.walk(base):
75
74
        for d in dirs:
76
 
            p = '/'.join([urllib.quote(x) for x in root.split('/\\') + [d]])
 
75
            p = os.path.join(root, d)
77
76
            test.assertTransportMode(t, p, dir_mode)
78
77
        for f in files:
79
78
            p = os.path.join(root, f)
80
 
            p = '/'.join([urllib.quote(x) for x in root.split('/\\') + [f]])
81
79
            test.assertTransportMode(t, p, file_mode)
82
80
 
83
81
 
90
88
        t = self.make_branch_and_tree('.')
91
89
        b = t.branch
92
90
        open('a', 'wb').write('foo\n')
93
 
        # ensure check_mode_r works with capital-letter file-ids like TREE_ROOT
94
 
        t.add('a', 'CAPS-ID')
 
91
        t.add('a')
95
92
        t.commit('foo')
96
93
 
97
94
        chmod_r('.bzr', 0644, 0755)
159
156
        #                    extra chmod calls aren't being made
160
157
        try:
161
158
            transport = get_transport(self.get_url())
162
 
            transport.put_bytes('my-lock', '')
 
159
            transport.put('my-lock', StringIO(''))
163
160
            lockable = LockableFiles(transport, 'my-lock', TransportLock)
164
161
            self.assertNotEqual(None, lockable._dir_mode)
165
162
            self.assertNotEqual(None, lockable._file_mode)
279
276
            self.assertTransportMode(t, 'a', 0666 &~umask)
280
277
 
281
278
            # but Transport overrides umask
282
 
            t.put_bytes('b', 'txt', mode=0666)
 
279
            t.put('b', 'txt', mode=0666)
283
280
            self.assertTransportMode(t, 'b', 0666)
284
281
 
285
 
            t._get_sftp().mkdir('c', mode=0777)
 
282
            t._sftp.mkdir('c', mode=0777)
286
283
            self.assertTransportMode(t, 'c', 0777 &~umask)
287
284
 
288
285
            t.mkdir('d', mode=0777)