]> source.dussan.org Git - rspamd.git/commitdiff
[Test] Add test for legacy RSPAMC protocol 742/head
authorAndrew Lewis <nerf@judo.za.org>
Fri, 22 Jul 2016 09:15:31 +0000 (10:15 +0100)
committerAndrew Lewis <nerf@judo.za.org>
Fri, 22 Jul 2016 09:15:31 +0000 (10:15 +0100)
test/functional/cases/general.robot
test/functional/lib/rspamd.py

index 5fb80520dc24742fffb7395012edaa5b5a32b2f5..8876ef9802be024619d77f859365c0094056ecef 100644 (file)
@@ -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
index 56356e599fed47eff35c4fd6cc9a0673c26ff26c..ef7c6e29c1716e508c179564a6b22bb5ecc065c9 100644 (file)
@@ -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())