source: code/test_uppirmirror.py @ 23

Last change on this file since 23 was 23, checked in by trishank, 7 years ago

Add pre-release upPIR from June 2011.

File size: 686 bytes
Line 
1# this is a few simple integration tests for an upPIR mirror.   Uses any local
2# mirror
3
4# if everything passes, there is no output
5
6import socket
7
8import session
9
10import getmyip
11
12mirrortocheck = getmyip.getmyip()
13
14def get_response(requeststring):
15  s = socket.socket()
16  s.connect((mirrortocheck,62294))
17  session.sendmessage(s,requeststring)
18  return session.recvmessage(s)
19 
20
21# We don't know the size so we won't test it 'working'...
22
23# are you friendly?
24assert('HI!' == get_response('HELLO'))
25
26# too short of a string (len 0)
27assert('Invalid request length' == get_response('XORBLOCK'))
28
29# too short of a string (len 0)
30assert('Invalid request type' == get_response('ajskdfjsad'))
Note: See TracBrowser for help on using the repository browser.