'Test StaticContentStream stream_data_in_range function,
asserts that we get the requested number of bytes
first_byte and last_byte are chosen to be simple but non trivial values
and to have total_length > STREAM_DATA_CHUNK_SIZE (1024)'

def test_static_content_stream_stream_data_in_range(self):

    data = SAMPLE_STRING
    item = FakeGridFsItem(data)
    static_content_stream = StaticContentStream('loc', 'name', 'type', item, length=item.length)
    first_byte = 100
    last_byte = 1500
    total_length = 0
    stream = static_content_stream.stream_data_in_range(first_byte, last_byte)
    for chunck in stream:
        total_length += len(chunck)
    self.assertEqual(total_length, ((last_byte - first_byte) + 1))
