class MultiPartProducerTestCase(unittest.TestCase): (source)
Tests for the L{MultiPartProducer} which gets dictionary like object with post parameters, converts them to mutltipart/form-data format and feeds them to an L{IConsumer}.
Method | get |
A convenience function to consume and return outpute. |
Method | new |
Undocumented |
Method | set |
Create a L{Cooperator} hooked up to an easily controlled, deterministic scheduler to use with L{MultiPartProducer}. |
Method | test_default |
If no L{Cooperator} instance is passed to L{MultiPartProducer}, the global cooperator is used. |
Method | test_failed |
If a read from the input file fails while producing bytes to the consumer, the L{Deferred} returned by L{MultiPartProducer.startProducing} fires with a L{Failure} wrapping that exception. |
Method | test_fail |
If byte string is passed as a param and we don't know the encoding, fail early to prevent corrupted form posts |
Method | test_fail |
If byte string is passed as a param and we don't know the encoding, fail early to prevent corrupted form posts |
Method | test_fields |
Make sure multiple fields are rendered properly. |
Method | test_input |
When L{MultiPartProducer} reaches end-of-file on the input file given to it, the input file is closed. |
Method | test |
L{MultiPartProducer} instances provide L{IBodyProducer}. |
Method | test_known |
If the L{MultiPartProducer} is constructed with a file-like object with both C{seek} and C{tell} methods, its C{length} attribute is set to the size of the file as determined by those methods. |
Method | test_missing |
Make sure attachments without names are supported |
Method | test_multiple |
Make sure multiple fields, attachments etc are rendered properly. |
Method | test_new |
Make sure we generate proper format even with newlines in attachments |
Method | test_pause |
L{MultiPartProducer.pauseProducing} temporarily suspends writing bytes from the input file to the given L{IConsumer}. |
Method | test_resume |
L{MultoPartProducer.resumeProducing} re-commences writing bytes from the input file to the given L{IConsumer} after it was previously paused with L{MultiPartProducer.pauseProducing}. |
Method | test_start |
L{MultiPartProducer.startProducing} starts writing bytes from the input file to the given L{IConsumer} and returns a L{Deferred} which fires when they have all been written. |
Method | test_stop |
L{MultiPartProducer.stopProducing} stops the underlying L{IPullProducer} and the cooperative task responsible for calling C{resumeProducing} and closes the input file but does not cause the L{Deferred} returned by C{startProducing} to fire. |
Method | test_two |
Make sure multiple fields are rendered properly. |
Method | test_unicode |
Make sure unicode attachment names are supported. |
Method | test_unicode |
Make sure unicode string is passed properly |
Method | test_unknown |
If the L{MultiPartProducer} is constructed with a file-like object passed as a parameter without either a C{seek} or C{tell} method, its C{length} attribute is set to C{UNKNOWN_LENGTH}. |
Method | test_works |
Make sure the stuff we generated actually parsed by python cgi |
Instance Variable | cooperator |
Undocumented |
Method | _termination |
This method can be used as the C{terminationPredicateFactory} for a L{Cooperator}. It returns a predicate which immediately returns C{False}, indicating that no more work should be done this iteration... |
Instance Variable | _scheduled |
Undocumented |
Create a L{Cooperator} hooked up to an easily controlled, deterministic scheduler to use with L{MultiPartProducer}.
If a read from the input file fails while producing bytes to the consumer, the L{Deferred} returned by L{MultiPartProducer.startProducing} fires with a L{Failure} wrapping that exception.
If byte string is passed as a param and we don't know the encoding, fail early to prevent corrupted form posts
If byte string is passed as a param and we don't know the encoding, fail early to prevent corrupted form posts
When L{MultiPartProducer} reaches end-of-file on the input file given to it, the input file is closed.
If the L{MultiPartProducer} is constructed with a file-like object with both C{seek} and C{tell} methods, its C{length} attribute is set to the size of the file as determined by those methods.
L{MultiPartProducer.pauseProducing} temporarily suspends writing bytes from the input file to the given L{IConsumer}.
L{MultoPartProducer.resumeProducing} re-commences writing bytes from the input file to the given L{IConsumer} after it was previously paused with L{MultiPartProducer.pauseProducing}.
L{MultiPartProducer.startProducing} starts writing bytes from the input file to the given L{IConsumer} and returns a L{Deferred} which fires when they have all been written.
L{MultiPartProducer.stopProducing} stops the underlying L{IPullProducer} and the cooperative task responsible for calling C{resumeProducing} and closes the input file but does not cause the L{Deferred} returned by C{startProducing} to fire.
If the L{MultiPartProducer} is constructed with a file-like object passed as a parameter without either a C{seek} or C{tell} method, its C{length} attribute is set to C{UNKNOWN_LENGTH}.
This method can be used as the C{terminationPredicateFactory} for a L{Cooperator}. It returns a predicate which immediately returns C{False}, indicating that no more work should be done this iteration. This has the result of only allowing one iteration of a cooperative task to be run per L{Cooperator} iteration.