aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2024-03-14 13:19:53 +0000
committerVsevolod Stakhov <vsevolod@rspamd.com>2024-03-14 13:19:53 +0000
commitec6e00e2018ca265a8f7003cded358a3f61c2fa6 (patch)
treeb4859fd5099ee3e15a879f2dafcaac4f63070a7f /test
parent41e564da7af9c552cef0640c1fddb235cafd854e (diff)
downloadrspamd-ec6e00e2018ca265a8f7003cded358a3f61c2fa6.tar.gz
rspamd-ec6e00e2018ca265a8f7003cded358a3f61c2fa6.zip
[Test] Remove demjson dependency as it is clearly outdated and broken
Diffstat (limited to 'test')
-rw-r--r--test/functional/lib/rspamd.py80
1 files changed, 76 insertions, 4 deletions
diff --git a/test/functional/lib/rspamd.py b/test/functional/lib/rspamd.py
index 57f179123..12c863783 100644
--- a/test/functional/lib/rspamd.py
+++ b/test/functional/lib/rspamd.py
@@ -23,6 +23,78 @@
# 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.
+#
+# 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.
+#
+# 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.
+#
+# 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.
+#
+# 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.
+#
+# 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.
+#
+# 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 +113,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 +128,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 +273,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