From 0e698734b6304b448c0d14a07e72b85072bd0d1c Mon Sep 17 00:00:00 2001 From: Stephon Striplin Date: Mon, 8 Aug 2011 17:24:40 -0700 Subject: [PATCH] add non-existant prefix bucket list test --- s3tests/functional/test_s3.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/s3tests/functional/test_s3.py b/s3tests/functional/test_s3.py index 203f407..0e7423f 100644 --- a/s3tests/functional/test_s3.py +++ b/s3tests/functional/test_s3.py @@ -140,6 +140,19 @@ def test_bucket_delimiter_alt(): eq(names, ['bar', 'baz']) +def test_bucket_list_prefix_not_exist(): + bucket = _create_keys(keys=['b/a/r', 'b/a/c', 'b/a/g', 'g']) + + li = bucket.list(prefix='d', delimiter='/') + keys = [x for x in li if isinstance(x, boto.s3.key.Key)] + prefixes = [x for x in li if not isinstance(x, boto.s3.key.Key)] + + eq(prefixes, []) + + names = [e.name for e in keys] + eq(names, []) + + def test_bucket_notexist(): name = '{prefix}foo'.format(prefix=get_prefix()) print 'Trying bucket {name!r}'.format(name=name)