def test_mutipleRangeSetsContentHeaders(self):
    '\n        makeProducer when the Range header requests a single, satisfiable byte\n        range sets the Content-* headers appropriately.\n        '
    request = DummyRequest([])
    request.requestHeaders.addRawHeader(b'range', b'bytes=1-3,5-6')
    resource = self.makeResourceWithContent(b'abcdefghijkl', encoding='gzip')
    with resource.openForReading() as file:
        producer = resource.makeProducer(request, file)
        contentHeaders = self.contentHeaders(request)
        self.assertEqual(set([b'content-length', b'content-type']), set(contentHeaders.keys()))
        expectedLength = 5
        for (boundary, offset, size) in producer.rangeInfo:
            expectedLength += len(boundary)
        self.assertEqual((b'%d' % (expectedLength,)), contentHeaders[b'content-length'])
        self.assertIn(b'content-type', contentHeaders)
        contentType = contentHeaders[b'content-type']
        self.assertNotIdentical(None, re.match(b'multipart/byteranges; boundary="[^"]*"\\Z', contentType))
        self.assertNotIn(b'content-encoding', contentHeaders)
makeProducer when the Range header requests a single, satisfiable byte
range sets the Content-* headers appropriately.
def test_mutipleRangeSetsContentHeaders(self):
    '\n        makeProducer when the Range header requests a single, satisfiable byte\n        range sets the Content-* headers appropriately.\n        '
    request = DummyRequest([])
    request.requestHeaders.addRawHeader(b'range', b'bytes=1-3,5-6')
    resource = self.makeResourceWithContent(b'abcdefghijkl', encoding='gzip')
    with resource.openForReading() as file:
        producer = resource.makeProducer(request, file)
        contentHeaders = self.contentHeaders(request)
        self.assertEqual(set([b'content-length', b'content-type']), set(contentHeaders.keys()))
        expectedLength = 5
        for (boundary, offset, size) in producer.rangeInfo:
            expectedLength += len(boundary)
        self.assertEqual((b'%d' % (expectedLength,)), contentHeaders[b'content-length'])
        self.assertIn(b'content-type', contentHeaders)
        contentType = contentHeaders[b'content-type']
        self.assertNotIdentical(None, re.match(b'multipart/byteranges; boundary="[^"]*"\\Z', contentType))
        self.assertNotIn(b'content-encoding', contentHeaders)