'Any non FTP error raised inside STOR while opening the file is
converted into FileNotFound error and returned to the client together
with the path.
The unknown error is logged.'

def test_STORunknownErrorBecomesFileNotFound(self):

    d = self._userLogin()
    def failingOpenForWriting(ignore):
        '\n                                                Override    openForWriting.\n\n                                                @param    ignore:    ignored,    used    for    callback\n                                                @return:    an    error\n                                                '
        return defer.fail(AssertionError())
    def sendPASV(result):
        '\n                                                Send    the    PASV    command    required    before    port.\n\n                                                @param    result:    parameter    used    in    L{Deferred}\n                                                '
        return self.client.queueStringCommand('PASV')
    def mockDTPInstance(result):
        '\n                                                Fake    an    incoming    connection    and    create    a    mock    DTPInstance    so\n                                                that    PORT    command    will    start    processing    the    request.\n\n                                                @param    result:    parameter    used    in    L{Deferred}\n                                                '
        self.serverProtocol.dtpFactory.deferred.callback(None)
        self.serverProtocol.dtpInstance = object()
        self.serverProtocol.shell.openForWriting = failingOpenForWriting
        return result
    def checkLogs(result):
        '\n                                                Check    that    unknown    errors    are    logged.\n\n                                                @param    result:    parameter    used    in    L{Deferred}\n                                                '
        logs = self.flushLoggedErrors()
        self.assertEqual(1, len(logs))
        self.assertIsInstance(logs[0].value, AssertionError)
    d.addCallback(sendPASV)
    d.addCallback(mockDTPInstance)
    self.assertCommandFailed('STOR    something', ['550    something:    No    such    file    or    directory.'], chainDeferred=d)
    d.addCallback(checkLogs)
    return d
