コード例 #1
0
ファイル: test_sftp.py プロジェクト: pombredanne/launchpad-3
 def test_canAdaptToSFTPServer(self):
     avatar = self.makeCodehostingAvatar()
     # The adapter logs the SFTPStarted event, which gets the id of the
     # transport attribute of 'avatar'. Here we set transport to an
     # arbitrary object that can have its id taken.
     avatar.transport = object()
     server = ISFTPServer(avatar)
     self.assertIsInstance(server, TransportSFTPServer)
     product = self.factory.makeProduct()
     branch_name = self.factory.getUniqueString()
     deferred = server.makeDirectory(
         '~%s/%s/%s' % (avatar.username, product.name, branch_name),
         {'permissions': 0o777})
     return deferred
コード例 #2
0
 def __init__(self, data=None, avatar=None):
     FileTransferBase.__init__(self)
     self.client = ISFTPServer(avatar)  # yay interfaces
     self.openFiles = {}
     self.openDirs = {}