~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_permissions.py

  • Committer: Robert Collins
  • Date: 2010-05-06 07:48:22 UTC
  • mto: This revision was merged to the branch mainline in revision 5223.
  • Revision ID: robertc@robertcollins.net-20100506074822-0bsgf2j4h8jx0xkk
Added ``bzrlib.tests.matchers`` as a place to put matchers, along with
our first in-tree matcher. See the module docstring for details.
(Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2011 Canonical Ltd
 
1
# Copyright (C) 2005 Canonical Ltd
2
2
# -*- coding: utf-8 -*-
3
3
#
4
4
# This program is free software; you can redistribute it and/or modify
32
32
 
33
33
import os
34
34
import sys
 
35
import stat
 
36
from cStringIO import StringIO
35
37
import urllib
36
38
 
37
 
from bzrlib import transport
38
39
from bzrlib.branch import Branch
39
40
from bzrlib.bzrdir import BzrDir
40
41
from bzrlib.tests import TestCaseWithTransport, TestSkipped
41
42
from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer
 
43
from bzrlib.transport import get_transport
42
44
from bzrlib.workingtree import WorkingTree
43
45
 
44
46
 
63
65
    :param dir_mode: The mode for all directories
64
66
    :param include_base: If false, only check the subdirectories
65
67
    """
66
 
    t = test.get_transport()
 
68
    t = get_transport(".")
67
69
    if include_base:
68
70
        test.assertTransportMode(t, base, dir_mode)
69
71
    for root, dirs, files in os.walk(base):
178
180
 
179
181
        # bodge around for stubsftpserver not letting use connect
180
182
        # more than once
181
 
        _t = self.get_transport()
 
183
        _t = get_transport(self.get_url())
182
184
 
183
185
        os.mkdir('local')
184
186
        t_local = self.make_branch_and_tree('local')
255
257
        original_umask = os.umask(umask)
256
258
 
257
259
        try:
258
 
            t = self.get_transport()
 
260
            t = get_transport(self.get_url())
259
261
            # Direct access should be masked by umask
260
262
            t._sftp_open_exclusive('a', mode=0666).write('foo\n')
261
263
            self.assertTransportMode(t, 'a', 0666 &~umask)