'When not logged in, most commands other than USER and PASS should
get NOT_LOGGED_IN errors, but some can be called before USER and PASS.'

def test_NotLoggedInReply(self):

    loginRequiredCommandList = ['CDUP', 'CWD', 'LIST', 'MODE', 'PASV', 'PWD', 'RETR', 'STRU', 'SYST', 'TYPE']
    loginNotRequiredCommandList = ['FEAT']
    def checkFailResponse(exception, command):
        failureResponseLines = exception.args[0]
        self.assertTrue(failureResponseLines[(-1)].startswith('530'), ("%s    -    Response    didn't    start    with    530:    %r" % (command, failureResponseLines[(-1)])))
    def checkPassResponse(result, command):
        result = result[0]
        self.assertFalse(result.startswith('530'), ('%s    -    Response    start    with    530:    %r' % (command, result)))
    deferreds = []
    for command in loginRequiredCommandList:
        deferred = self.client.queueStringCommand(command)
        self.assertFailure(deferred, ftp.CommandFailed)
        deferred.addCallback(checkFailResponse, command)
        deferreds.append(deferred)
    for command in loginNotRequiredCommandList:
        deferred = self.client.queueStringCommand(command)
        deferred.addCallback(checkPassResponse, command)
        deferreds.append(deferred)
    return defer.DeferredList(deferreds, fireOnOneErrback=True)
