commit 4d2c290: [Test] Add endpoint for settings tests

Vsevolod Stakhov vsevolod at rspamd.com
Sat Nov 26 15:42:05 UTC 2022


Author: Vsevolod Stakhov
Date: 2022-11-26 15:36:02 +0000
URL: https://github.com/rspamd/rspamd/commit/4d2c290632013e962c59ccc81485792aec5ad8d1 (HEAD -> master)

[Test] Add endpoint for settings tests

---
 test/functional/util/dummy_http.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/test/functional/util/dummy_http.py b/test/functional/util/dummy_http.py
index 6ca084403..92b538845 100755
--- a/test/functional/util/dummy_http.py
+++ b/test/functional/util/dummy_http.py
@@ -71,6 +71,7 @@ class MyHandler(http.server.BaseHTTPRequestHandler):
         """Respond to a POST request."""
         response = b"hello post"
         content_length = int(self.headers.get('Content-Length', "0")) or 0
+        content_type = "text/plain"
         if content_length > 0:
             _ = self.rfile.read(content_length)
         if self.path == "/empty":
@@ -86,6 +87,9 @@ class MyHandler(http.server.BaseHTTPRequestHandler):
             self.send_response(200)
         if self.path == "/map-simple":
             response = b"hello map"
+        if self.path == "/settings":
+            response = b"{\"actions\": { \"reject\": 1.0}}"
+            content_type = "application/json"
 
         self.send_header("Content-Length", str(len(response)))
         conntype = self.headers.get('Connection', "").lower()
@@ -94,7 +98,7 @@ class MyHandler(http.server.BaseHTTPRequestHandler):
         else:
             self.send_header("Connection", "keep-alive")
 
-        self.send_header("Content-type", "text/plain")
+        self.send_header("Content-type", content_type)
         self.end_headers()
         self.wfile.write(response)
         self.log_message("to be closed: %d, headers: %s, conn:'%s'" % (self.close_connection, str(self.headers), self.headers.get('Connection', "").lower()))


More information about the Commits mailing list