~toddy/bzr/bzr.i18n

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_lockable_files.py

  • Committer: Tobias Toedter
  • Date: 2007-12-30 18:52:13 UTC
  • mfrom: (2438.1.708 +trunk)
  • Revision ID: t.toedter@gmx.net-20071230185213-7xiqpbtshmnsf073
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
from StringIO import StringIO
18
18
 
19
19
import bzrlib
20
 
import bzrlib.errors as errors
 
20
from bzrlib import (
 
21
    errors,
 
22
    lockdir,
 
23
    osutils,
 
24
    )
21
25
from bzrlib.errors import BzrBadParameterNotString, NoSuchFile, ReadOnlyError
22
26
from bzrlib.lockable_files import LockableFiles, TransportLock
23
 
from bzrlib import lockdir
24
 
from bzrlib.lockdir import LockDir
25
27
from bzrlib.tests import TestCaseInTempDir
26
28
from bzrlib.tests.test_smart import TestCaseWithSmartMedium
27
29
from bzrlib.tests.test_transactions import DummyWeave
347
349
        self.lockable.create_lock()
348
350
 
349
351
    def get_lockable(self):
350
 
        return LockableFiles(self.transport, 'my-lock', LockDir)
 
352
        return LockableFiles(self.transport, 'my-lock', lockdir.LockDir)
351
353
 
352
354
    def test_lock_created(self):
353
355
        self.assertTrue(self.transport.has('my-lock'))
357
359
        self.assertFalse(self.transport.has('my-lock/held/info'))
358
360
        self.assertTrue(self.transport.has('my-lock'))
359
361
 
 
362
    def test__file_modes(self):
 
363
        self.transport.mkdir('readonly')
 
364
        osutils.make_readonly('readonly')
 
365
        lockable = LockableFiles(self.transport.clone('readonly'), 'test-lock',
 
366
                                 lockdir.LockDir)
 
367
        # The directory mode should be read-write-execute for the current user
 
368
        self.assertEqual(00700, lockable._dir_mode & 00700)
 
369
        # Files should be read-write for the current user
 
370
        self.assertEqual(00600, lockable._file_mode & 00700)
360
371
 
361
 
    # TODO: Test the lockdir inherits the right file and directory permissions
362
 
    # from the LockableFiles.
363
 
        
364
372
 
365
373
class TestLockableFiles_RemoteLockDir(TestCaseWithSmartMedium,
366
374
                              _TestLockableFiles_mixin):