def testNotLoggedInReply(self):
"""When not logged in, all commands other than USER and PASS should
get NOT_LOGGED_IN errors.
"""
commandList = ['CDUP', 'CWD', 'LIST', 'MODE', 'PASV',
'PWD', 'RETR', 'STRU', 'SYST', 'TYPE']
# Issue commands, check responses
def checkResponse(exception):
failureResponseLines = exception.args[0]
self.failUnless(failureResponseLines[-1].startswith("530"),
"Response didn't start with 530: %r"
% (failureResponseLines[-1],))
deferreds = []
for command in commandList:
deferred = self.client.queueStringCommand(command)
self.assertFailure(deferred, ftp.CommandFailed)
deferred.addCallback(checkResponse)
deferreds.append(deferred)
return defer.DeferredList(deferreds, fireOnOneErrback=True)
评论列表
文章目录