Skip to content

Commit 30a76a3

Browse files
committed
tests: Negative tests should ignore exceptions properly
1 parent 881755b commit 30a76a3

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

tests/functional/tests.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -628,12 +628,23 @@ def test_negative_put_object_with_path_segment(client, log_output):
628628
object_name,
629629
io.BytesIO(b''), 0)
630630
except ResponseError as err:
631-
pass
631+
if err.code != 'XMinioInvalidObjectName':
632+
raise Exception(err)
633+
else:
634+
pass
632635
except Exception as err:
633636
raise Exception(err)
634637
finally:
635638
try:
636-
client.remove_object(bucket_name, object_name)
639+
try:
640+
client.remove_object(bucket_name, object_name)
641+
except ResponseError as err:
642+
if err.code != 'XMinioInvalidObjectName':
643+
raise Exception(err)
644+
else:
645+
pass
646+
except Exception as err:
647+
raise Exception(err)
637648
client.remove_bucket(bucket_name)
638649
except Exception as err:
639650
raise Exception(err)

0 commit comments

Comments
 (0)