Skip to content

Commit

Permalink
write test pysrs log to file
Browse files Browse the repository at this point in the history
  • Loading branch information
sdgathman committed Sep 11, 2020
1 parent 0c108a9 commit 66c1ca9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion SocketMap.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def handle(self):
except LookupError as x:
self.write("NOTFOUND")
except Exception as x:
#print x
#print(x)
self.write("TEMP %s"%x)
# PERM,TIMEOUT

Expand Down
21 changes: 11 additions & 10 deletions testSRS.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,16 +260,17 @@ def testExim(self,sockname='/tmp/exsrsd',secret="shhhh!"):
def testSocketMap(self,sockname='/tmp/srsd',secret="shhhh!"):
import pysrs,subprocess,time
print()
with subprocess.Popen(['./pysrs.py','test/pysrs.cfg']) as p:
time.sleep(1)
try:
m = SocketMap('/tmp/srsd')
sender = 'mouse<@orig.com.>'
# Sample req: 'make_srs unilit.us.\x9bstuart<@gathman.org.>'
res,srsaddr = m.sendmap('make-srs','second.com',sender)
res,addr = m.sendmap('reverse-srs',srsaddr)
finally: m.close()
p.terminate()
with open('test/pysrs.log','w') as fp:
with subprocess.Popen(['./pysrs.py','test/pysrs.cfg'],stdout=fp) as p:
time.sleep(1)
try:
m = SocketMap('/tmp/srsd')
sender = 'mouse<@orig.com.>'
# Sample req: 'make_srs unilit.us.\x9bstuart<@gathman.org.>'
res,srsaddr = m.sendmap('make-srs','second.com',sender)
res,addr = m.sendmap('reverse-srs',srsaddr)
finally: m.close()
p.terminate()
self.assertEqual('OK',res)
self.assertEqual(sender,addr)

Expand Down

0 comments on commit 66c1ca9

Please sign in to comment.