~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to supermirrorsftp/tests/test_fs_restrictions.py

  • Committer: Andrew Bennetts
  • Date: 2005-11-29 12:25:17 UTC
  • mto: (2902.2.21 tomerge)
  • mto: This revision was merged to the branch mainline in revision 3289.
  • Revision ID: andrew.bennetts@canonical.com-20051129122517-a377ada503e93665
Start adding tests for bazaarfs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
import os
 
3
import shutil
 
4
 
 
5
from twisted.trial import unittest
 
6
 
 
7
from supermirrorsftp.sftponly import SFTPOnlyAvatar
 
8
from supermirrorsftp.bazaarfs import SFTPServerRoot
 
9
 
 
10
class TestTopLevelDir(unittest.TestCase):
 
11
    def testListDir(self):
 
12
        # list only user dir + team dirs
 
13
        tmpdir = self.mktemp()
 
14
        os.mkdir(tmpdir)
 
15
        userDict = {'id': 1, 'name': 'alice', 'teams': []}
 
16
        avatar = SFTPOnlyAvatar('alice', tmpdir, '/dev/null', userDict)
 
17
        root = SFTPServerRoot(avatar)
 
18
        self.assertEqual(
 
19
            [name for name, child in root.children()], 
 
20
            ['.', '..', '~alice'])
 
21
        shutil.rmtree(tmpdir)
 
22
 
 
23
    def testAllWriteOpsForbidden(self):
 
24
        # mkdir
 
25
        # make new file
 
26
        # ...?
 
27
        pass
 
28