selftest: fix potential reference before assigned error
authorNoel Power <noel.power@suse.com>
Thu, 28 Mar 2024 09:09:02 +0000 (09:09 +0000)
committerJule Anger <janger@samba.org>
Thu, 11 Apr 2024 09:42:10 +0000 (09:42 +0000)
This would only happen if the test failed (but the message would be
incorrect as 'e' the exception to be stringified doesn't exist.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15611
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit efdbf0511e0a89f865210170001fbebf17a45278)

python/samba/tests/blackbox/http_chunk.py
python/samba/tests/blackbox/http_content.py

index 175c60d98a2a14ca10a8d911b71770613085979b..150ab2a31538977a7d2b48fd4cf73dd72ff3d854 100644 (file)
@@ -99,7 +99,7 @@ class HttpChunkBlackboxTests(BlackboxTestCase):
         try:
             msg = "snglechunksnglechunksnglechunksnglechunksnglechunk"
             resp = self.check_output("%s -d11 -U%% -I%s --rsize 49 --uri %s" % (COMMAND, os.getenv("SERVER_IP", "localhost"), msg))
-            self.fail(str(e))
+            self.fail("unexpected success")
         except BlackboxProcessError as e:
             if "http_read_chunk: size 50 exceeds max content len 49 skipping body" not in e.stderr.decode('utf-8'):
                 self.fail(str(e))
index 9ecb6ffe279ab9c7cd6add8d24f4b8c9b7be33a6..3d674aa8db7b9a3fbfe58968346a65d7f26ebbe7 100644 (file)
@@ -77,7 +77,7 @@ class HttpContentBlackboxTests(BlackboxTestCase):
             msg = "012345678" # 9 bytes
             # limit response to 8 bytes
             resp = self.check_output("%s -d11 -U%% -I%s --rsize 8 --uri %s" % (COMMAND, os.getenv("SERVER_IP", "localhost"), msg))
-            self.fail(str(e))
+            self.fail("unexpected success")
         except BlackboxProcessError as e:
             if "unexpected 0 len response" not in e.stdout.decode('utf-8'):
                 self.fail(str(e))