'If a response includes a body with a length given by the
I{Content-Length} header, the bytes which make up the body are passed
to the C{_bodyDataReceived} callback on the L{HTTPParser}.'

def test_contentLength(self):

    finished = []
    protocol = HTTPClientParser(Request('GET', '/', _boringHeaders, None), finished.append)
    transport = StringTransport()
    protocol.makeConnection(transport)
    protocol.dataReceived('HTTP/1.1    200    OK\r\n')
    body = []
    protocol.response._bodyDataReceived = body.append
    protocol.dataReceived('Content-Length:    10\r\n')
    protocol.dataReceived('\r\n')
    self.assertEqual(transport.producerState, u'paused')
    self.assertEqual(protocol.state, BODY)
    protocol.dataReceived(('x' * 6))
    self.assertEqual(body, [('x' * 6)])
    self.assertEqual(protocol.state, BODY)
    protocol.dataReceived(('y' * 4))
    self.assertEqual(body, [('x' * 6), ('y' * 4)])
    self.assertEqual(protocol.state, DONE)
    self.assertEqual(finished, [''])
