2007-08-29 10:16:33 +00:00
|
|
|
##
|
|
|
|
# Copyright 2007 Steve 'Tarka' Smith (tarka@internode.on.net)
|
|
|
|
# Distributed under the same terms as Deluge
|
|
|
|
##
|
|
|
|
|
2007-06-24 10:32:51 +00:00
|
|
|
import unittest
|
2007-06-25 07:53:58 +00:00
|
|
|
from text import TextReader, GZMuleReader, PGZip
|
2007-06-24 10:32:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
class ImportTests(unittest.TestCase):
|
|
|
|
|
|
|
|
def testpgtext(self):
|
2007-06-25 07:53:58 +00:00
|
|
|
fr = TextReader("pg.txt")
|
|
|
|
ips = fr.next()
|
2007-06-24 10:32:51 +00:00
|
|
|
self.assertEqual("3.0.0.0", ips[0])
|
|
|
|
self.assertEqual("3.255.255.255", ips[1])
|
|
|
|
|
|
|
|
def testMule(self):
|
2007-06-25 07:53:58 +00:00
|
|
|
fr = GZMuleReader("nipfilter.dat.gz")
|
|
|
|
ips = fr.next()
|
2007-06-24 10:32:51 +00:00
|
|
|
self.assertEqual("0.0.0.0", ips[0])
|
|
|
|
self.assertEqual("3.255.255.255", ips[1])
|
|
|
|
|
2007-06-25 07:53:58 +00:00
|
|
|
def testZip(self):
|
|
|
|
fr = PGZip("splist.zip")
|
|
|
|
ips = fr.next()
|
|
|
|
print "wibble wibble",ips
|
|
|
|
self.assertEqual("1.1.1.1", ips[0])
|
|
|
|
self.assertEqual("3.255.255.255", ips[1])
|
|
|
|
|
|
|
|
ips = fr.next()
|
|
|
|
self.assertEqual("0.0.0.0", ips[0])
|
|
|
|
self.assertEqual("3.255.255.255", ips[1])
|
|
|
|
|
|
|
|
ips = fr.next()
|
|
|
|
self.assertEqual(ips, False)
|
|
|
|
|
2007-06-24 10:32:51 +00:00
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main()
|