'Any FTP error raised inside STOR while opening the file is returned
to the client.'

def test_STORreturnsErrorFromOpen(self):

    self.dirPath.child(self.username).createDirectory()
    self.dirPath.child(self.username).child('folder').createDirectory()
    d = self._userLogin()
    def sendPASV(result):
        '\n                                                Send    the    PASV    command    required    before    port.\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                                                '
        self.serverProtocol.dtpFactory.deferred.callback(None)
        self.serverProtocol.dtpInstance = object()
        return result
    d.addCallback(sendPASV)
    d.addCallback(mockDTPInstance)
    self.assertCommandFailed('STOR    folder', ['550    folder:    is    a    directory'], chainDeferred=d)
    return d
