Do Not Expect Symbol SIMPLE_POST
Do Not Expect Symbol SIMPLE_PRE
+SETTINGS ID - EXTERNAL MAP
+ Scan File ${MESSAGE} Settings-Id=external
+ Expect Symbol EXTERNAL_SETTINGS
+
PRIORITY
Scan File ${MESSAGE_PRIORITY} Settings-Id=id_virtual_group From=user@test.com
Expect Symbol PRIORITY_2
Settings Setup
Copy File ${RSPAMD_TESTDIR}/data/bayes.spam.sqlite3 /tmp/bayes.spam.sqlite3
Copy File ${RSPAMD_TESTDIR}/data/bayes.ham.sqlite3 /tmp/bayes.ham.sqlite3
+ Run Dummy Http
Rspamd Setup
Settings Teardown
Rspamd Teardown
+ ${http_pid} = Get File /tmp/dummy_http.pid
+ Shutdown Process With Children ${http_pid}
Remove Files /tmp/bayes.spam.sqlite3 /tmp/bayes.ham.sqlite3
+
+Run Dummy Http
+ ${result} = Start Process ${RSPAMD_TESTDIR}/util/dummy_http.py
+ Wait Until Created /tmp/dummy_http.pid
groups_enabled = [];
}
}
+
+ external {
+ disabled = true
+ external_map = {
+ map = {
+ backend = "http://127.0.0.1:18080/settings";
+ external = true;
+ method = "body";
+ encode = "json";
+ }
+ selector = "id('from');from('mime')";
+ }
+ register_symbols = {
+ EXTERNAL_SETTINGS = { score = 1.0 }
+ }
+ }
}
classifier {
if self.path == "/map-simple":
response = b"hello map"
if self.path == "/settings":
- response = b"{\"actions\": { \"reject\": 1.0}}"
+ response = b"{\"actions\": { \"reject\": 1.0}, \"symbols\": { \"EXTERNAL_SETTINGS\": 1.0 }}"
content_type = "application/json"
self.send_header("Content-Length", str(len(response)))