'Any FTP error raised by STOR while transferring the file is returned
to the client.'

def test_STORtransferErrorIsReturned(self):

    class FailingFileWriter(ftp._FileWriter, ):
        def receive(self):
            return defer.fail(ftp.IsADirectoryError('failing_file'))
    def failingSTOR(a, b):
        return defer.succeed(FailingFileWriter(None))
    self.patch(ftp.FTPAnonymousShell, 'openForWriting', failingSTOR)
    def eb(res):
        res.trap(ftp.CommandFailed)
        logs = self.flushLoggedErrors()
        self.assertEqual(1, len(logs))
        self.assertIsInstance(logs[0].value, ftp.IsADirectoryError)
        self.assertEqual(res.value.args[0][0], '550    failing_file:    is    a    directory')
    (d1, d2) = self.client.storeFile('failing_file')
    d2.addErrback(eb)
    return defer.gatherResults([d1, d2])
