Commit 9a516871 authored by Levin Zimmermann's avatar Levin Zimmermann

bt5/erp5_wendelin/DataBucketStream: Fix getBucketByIndex

Before this patch 'getBucketByIndex' was buggy & would fail with

    AttributeError: 'str' object has no attribute 'value'

But it wasn't recognized, because this method wasn't tested before. This
patch adds a test to the method & fixes it.
parent d62aa947
......@@ -206,7 +206,7 @@ class DataBucketStream(Document):
Get one bucket
"""
key = self._long_index_tree[index]
return self.getBucketByKey(key).value
return self.getBucketByKey(key)
def getKeyByIndex(self, index):
"""
......@@ -432,4 +432,4 @@ for index_class in (
ContainerAssertions[index_class] = 1
# Cleanup
del index_class
\ No newline at end of file
del index_class
......@@ -261,6 +261,7 @@ class Test(ERP5TypeTestCase):
key = len(bucket_stream) + 1
bucket_stream.insertBucket(key, bin_string )
self.assertEqual(bin_string, bucket_stream.getBucketByKey(key))
self.assertEqual(bin_string, bucket_stream.getBucketByIndex(0))
# test sequence
self.assertEqual(1, len(bucket_stream))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment