'The C{Deferred} returned by L{basic.FileSender.beginFileTransfer} fails
with an C{Exception} if C{stopProducing} when the transfer is not
complete.'

def test_abortedTransfer(self):

    source = BytesIO('Test    content')
    consumer = proto_helpers.StringTransport()
    sender = basic.FileSender()
    d = sender.beginFileTransfer(source, consumer)
    sender.stopProducing()
    failure = self.failureResultOf(d)
    failure.trap(Exception)
    self.assertEqual('Consumer    asked    us    to    stop    producing', str(failure.value))
