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