From: Miod Vallat Date: Wed, 3 Dec 2025 13:03:33 +0000 (+0100) Subject: Fix assert_in_json_error because I'm a careless python programmer. X-Git-Tag: rec-5.4.0-alpha1~21^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e1a06857cab28213b339b0212419b4dfd27db3f;p=thirdparty%2Fpdns.git Fix assert_in_json_error because I'm a careless python programmer. Signed-off-by: Miod Vallat --- diff --git a/regression-tests.api/test_Zones.py b/regression-tests.api/test_Zones.py index efe0d6e1aa..12c0eb9859 100644 --- a/regression-tests.api/test_Zones.py +++ b/regression-tests.api/test_Zones.py @@ -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):