aboutsummaryrefslogtreecommitdiffstats
path: root/test/functional
diff options
context:
space:
mode:
authorAndrew Lewis <nerf@judo.za.org>2016-07-22 10:15:31 +0100
committerAndrew Lewis <nerf@judo.za.org>2016-07-22 10:15:31 +0100
commitf133174add5a794d79dc896cf3044c63ac8efeb0 (patch)
tree682ed0d6222ac347d59fac0530f2750e8b0baf37 /test/functional
parent74f6d73a40512220b05a7f0e0d6f5558a58b2146 (diff)
downloadrspamd-f133174add5a794d79dc896cf3044c63ac8efeb0.tar.gz
rspamd-f133174add5a794d79dc896cf3044c63ac8efeb0.zip
[Test] Add test for legacy RSPAMC protocol
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/cases/general.robot5
-rw-r--r--test/functional/lib/rspamd.py13
2 files changed, 18 insertions, 0 deletions
diff --git a/test/functional/cases/general.robot b/test/functional/cases/general.robot
index 5fb80520d..8876ef980 100644
--- a/test/functional/cases/general.robot
+++ b/test/functional/cases/general.robot
@@ -35,3 +35,8 @@ GTUBE - SPAMC
${result} = Spamc ${LOCAL_ADDR} ${PORT_NORMAL} ${GTUBE}
Follow Rspamd Log
Should Contain ${result} GTUBE
+
+GTUBE - RSPAMC
+ ${result} = Rspamc ${LOCAL_ADDR} ${PORT_NORMAL} ${GTUBE}
+ Follow Rspamd Log
+ Should Contain ${result} GTUBE
diff --git a/test/functional/lib/rspamd.py b/test/functional/lib/rspamd.py
index 56356e599..ef7c6e29c 100644
--- a/test/functional/lib/rspamd.py
+++ b/test/functional/lib/rspamd.py
@@ -41,6 +41,19 @@ def read_log_from_position(filename, offset):
size = len(goo)
return [goo, size+offset]
+def rspamc(addr, port, filename):
+ mboxgoo = b"From MAILER-DAEMON Fri May 13 19:17:40 2016\r\n"
+ goo = open(filename, 'rb').read()
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ s.connect((addr, port))
+ s.send(b"CHECK RSPAMC/1.0\r\nContent-length: ")
+ s.send(str(len(goo+mboxgoo)).encode('utf-8'))
+ s.send(b"\r\n\r\n")
+ s.send(mboxgoo)
+ s.send(goo)
+ r = s.recv(2048)
+ return r.decode('utf-8')
+
def scan_file(addr, port, filename):
return str(urlopen("http://%s:%s/symbols?file=%s" % (addr, port, filename)).read())