diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2024-03-14 20:44:12 +0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-14 20:44:12 +0600 |
commit | de384ad1e4f0c0b4a79847e8b182fdf9c0b930f6 (patch) | |
tree | 1e350333fe84252f483538777c137b8b85355d8d | |
parent | 41e564da7af9c552cef0640c1fddb235cafd854e (diff) | |
parent | 9e53ac263ef31085f7db86f037d2be0b57ecef40 (diff) | |
download | rspamd-de384ad1e4f0c0b4a79847e8b182fdf9c0b930f6.tar.gz rspamd-de384ad1e4f0c0b4a79847e8b182fdf9c0b930f6.zip |
Merge pull request #4871 from rspamd/vstakhov-remove-demjson
Remove demjson dependency as it is clearly outdated and broken
-rw-r--r-- | test/functional/lib/rspamd.py | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/test/functional/lib/rspamd.py b/test/functional/lib/rspamd.py index 57f179123..4c272b004 100644 --- a/test/functional/lib/rspamd.py +++ b/test/functional/lib/rspamd.py @@ -12,17 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. from urllib.request import urlopen import glob @@ -41,11 +30,11 @@ import tempfile from robot.api import logger from robot.libraries.BuiltIn import BuiltIn -import demjson +import json def Check_JSON(j): - d = demjson.decode(j, strict=True) + d = json.JSONDecoder(strict=True).decode(j) logger.debug('got json %s' % d) assert len(d) > 0 assert 'error' not in d @@ -56,7 +45,7 @@ def check_json_log(fn): line_count = 0 f = open(fn, 'r') for l in f.readlines(): - d = demjson.decode(l, strict=True) + d = json.JSONDecoder(strict=True).decode(l) assert len(d) > 0 line_count = line_count + 1 assert line_count > 0 @@ -201,7 +190,7 @@ def Scan_File(filename, **headers): c.request("POST", "/checkv2", open(filename, "rb"), headers) r = c.getresponse() assert r.status == 200 - d = demjson.decode(r.read()) + d = json.JSONDecoder(strict=True).decode(r.read().decode('utf-8')) c.close() BuiltIn().set_test_variable("${SCAN_RESULT}", d) return |