[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[minion-cvs] Test new cases of path generation
Update of /home/minion/cvsroot/src/minion/lib/mixminion
In directory moria.mit.edu:/tmp/cvs-serv1917/lib/mixminion
Modified Files:
test.py
Log Message:
Test new cases of path generation
Index: test.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/test.py,v
retrieving revision 1.162
retrieving revision 1.163
diff -u -d -r1.162 -r1.163
--- test.py 8 Nov 2003 05:35:57 -0000 1.162
+++ test.py 8 Nov 2003 05:57:38 -0000 1.163
@@ -6338,16 +6338,19 @@
# wrap path parsing and verification and generation.
def ppath(dir, cfg, path, addr, nHops=None, startAt=None, endAt=None,
- halfPath=0, defaultNHops=None):
+ halfPath=0, defaultNHops=None, nPaths=1):
isReply = halfPath and (addr is None)
isSURB = halfPath and (addr is not None)
pathSpec = mixminion.ClientDirectory.parsePath(
cfg, path, nHops=nHops, isReply=isReply,
isSURB=isSURB, defaultNHops=defaultNHops)
dir.validatePath(pathSpec, addr, startAt=startAt, endAt=endAt)
- paths = dir.generatePaths(1, pathSpec, addr, startAt,endAt)
- assert len(paths) == 1
- return paths[0]
+ paths = dir.generatePaths(nPaths, pathSpec, addr, startAt, endAt)
+ if nPaths == 1:
+ assert len(paths) == 1
+ return paths[0]
+ else:
+ return paths
paddr = mixminion.ClientDirectory.parseAddress
email = paddr("smtp:lloyd@dobler.com")
@@ -6393,6 +6396,8 @@
pathIs((p1,p2), ((alice,fred),(bob,lola)))
p1,p2 = ppath(ks, None, "Alice,Fred,Bob,Lola", mboxWithoutServer)
pathIs((p1,p2), ((alice,fred),(bob,lola)))
+ p1,p2 = ppath(ks, None, "Alice,Fred,Bob,Lola", mboxWithServer)
+ pathIs((p1,p2), ((alice,fred),(bob,lola)))
p1,p2 = ppath(ks, None, "Alice,?,?,Bob", mboxWithServer)
eq((len(p1),len(p2)), (3,2))
pathIs((p1[:1],p2[-2:]), ((alice,),(bob,lola)))
@@ -6503,6 +6508,16 @@
p1,p2 = ppath(ks, None, "*3", email, halfPath=1)
eq((len(p1),len(p2)), (0,3))
+ # 1g. Multiple paths
+ (p1,p2),(p3,p4) = ppath(ks,None,"?:*3",email,nPaths=2)
+ self.assertEquals(map(len,[p1,p2,p3,p4]),[1,3,1,3])
+ fragEmail2 = paddr("foo@bar.com")
+ fragEmail2.setFragmented(1,3)
+ (p1,p2),(p3,p4),(p5,p6) = ppath(ks,None,"?:*3",email,nPaths=3)
+ self.assertEquals(map(len,[p1,p2,p3,p4,p5,p6]),[1,3,1,3,1,3])
+ self.assertEquals(p2[-1].getNickname(), p4[-1].getNickname())
+ self.assertEquals(p2[-1].getNickname(), p6[-1].getNickname())
+
# 2. Failing cases
raises = self.assertRaises
# Nonexistent server
@@ -6986,7 +7001,7 @@
tc = loader.loadTestsFromTestCase
if 0:
- suite.addTest(tc(ClientUtilTests))
+ suite.addTest(tc(ClientDirectoryTests))
return suite
testClasses = [MiscTests,
MinionlibCryptoTests,