]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Fix assert_in_json_error because I'm a careless python programmer.
authorMiod Vallat <miod.vallat@powerdns.com>
Wed, 3 Dec 2025 13:03:33 +0000 (14:03 +0100)
committerMiod Vallat <miod.vallat@powerdns.com>
Thu, 4 Dec 2025 11:58:43 +0000 (12:58 +0100)
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
regression-tests.api/test_Zones.py

index efe0d6e1aa32ec84e2710d1a39443415e09e4f6b..12c0eb9859ebafee932f4bcb8556bea0e1a42cfd 100644 (file)
@@ -81,13 +81,16 @@ def templated_rrsets(rrsets: list, zonename: str):
 class ZonesApiTestCase(ApiTestCase):
 
     def assert_in_json_error(self, expected, json):
-        if expected not in json['error']:
+        error = json['error']
+        if expected not in error:
             found = False
-            for item in json['errors']:
-                if expected in item:
-                    found = True
-            assert found, "%r not found in %r" % (expected, errors)
-
+            if 'errors' in json:
+                errors = json['errors']
+                for item in errors:
+                    if expected in item:
+                        found = True
+                assert found, "%r not found in %r" % (expected, errors)
+            assert found, "%r not found in %r" % (expected, error)
 
 class Zones(ZonesApiTestCase):