initial import of Connelly's public domain I2P python lib

This commit is contained in:
jrandom
2004-07-21 07:42:29 +00:00
committed by zzz
parent 8603250d73
commit 5214436d18
39 changed files with 4533 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
# -----------------------------------------------------
# test_eep.py: Unit tests for eep.py.
# -----------------------------------------------------
# Make sure we can import i2p
import sys; sys.path += ['../../']
import traceback, sys
from i2p import eep, sam, samclasses
def verify_html(s):
"""Raise an error if s does not end with </html>"""
assert s.strip().lower()[-7:] == '</html>'
def eepget_test():
try:
verify_html(eep.urlget('http://duck.i2p/index.html'))
verify_html(eep.urlget('http://duck.i2p/'))
verify_html(eep.urlget('http://duck.i2p'))
verify_html(eep.urlget('duck.i2p/'))
verify_html(eep.urlget('duck.i2p'))
except Exception, e:
print 'Unit test failed for eepget'
print "Note that urllib2.urlopen uses IE's proxy settings " + \
"in Windows."
print "This may cause " + \
"urllib2.urlopen('http://www.google.com/') to fail."
traceback.print_exc(); sys.exit()
print 'eepget: OK'
def test():
eepget_test()
if __name__ == '__main__':
print 'Testing:'
test()