[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[minion-cvs] Make pychecker far happier; update many copyright notic...
Update of /home/minion/cvsroot/src/minion/lib/mixminion
In directory moria.mit.edu:/tmp/cvs-serv4440/lib/mixminion
Modified Files:
BuildMessage.py ClientDirectory.py ClientMain.py
ClientUtils.py Common.py Config.py Crypto.py Filestore.py
Fragments.py MMTPClient.py Packet.py ServerInfo.py
TLSConnection.py benchmark.py test.py testSupport.py
Log Message:
Make pychecker far happier; update many copyright notices; fix a couple actual bugs
Index: BuildMessage.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/BuildMessage.py,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- BuildMessage.py 3 Jan 2004 05:45:26 -0000 1.66
+++ BuildMessage.py 3 Jan 2004 07:35:23 -0000 1.67
@@ -1,4 +1,4 @@
-# Copyright 2002-2003 Nick Mathewson. See LICENSE for licensing information.
+# Copyright 2002-2004 Nick Mathewson. See LICENSE for licensing information.
# $Id$
"""mixminion.BuildMessage
Index: ClientDirectory.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/ClientDirectory.py,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- ClientDirectory.py 3 Jan 2004 05:45:26 -0000 1.22
+++ ClientDirectory.py 3 Jan 2004 07:35:23 -0000 1.23
@@ -1,4 +1,4 @@
-# Copyright 2002-2003 Nick Mathewson. See LICENSE for licensing information.
+# Copyright 2002-2004 Nick Mathewson. See LICENSE for licensing information.
# Id: ClientMain.py,v 1.89 2003/06/05 18:41:40 nickm Exp $
"""mixminion.ClientDirectory: Code to handle the 'client' side of
@@ -25,7 +25,6 @@
import mixminion.Config
import mixminion.Crypto
import mixminion.NetUtils
-import mixminion.Packet
import mixminion.ServerInfo
from mixminion.Common import LOG, MixError, MixFatalError, UIError, \
@@ -33,7 +32,8 @@
previousMidnight, readPickled, readPossiblyGzippedFile, \
replaceFile, tryUnlink, writePickled, floorDiv, isSMTPMailbox
from mixminion.Packet import MBOX_TYPE, SMTP_TYPE, DROP_TYPE, FRAGMENT_TYPE, \
- parseMBOXInfo, parseSMTPInfo, ParseError
+ parseMBOXInfo, parseRelayInfoByType, parseSMTPInfo, ParseError, \
+ ServerSideFragmentedMessage
# FFFF This should be made configurable and adjustable.
MIXMINION_DIRECTORY_URL = "http://mixminion.net/directory/Directory.gz"
@@ -470,8 +470,7 @@
nickname of the corresponding server. If no such server is
known, return a string representation of the routingInfo.
"""
- routingInfo = mixminion.Packet.parseRelayInfoByType(
- routingType, routingInfo)
+ routingInfo = parseRelayInfoByType(routingType, routingInfo)
nn = self.getNicknameByKeyID(routingInfo.keyinfo)
if nn is None:
return routingInfo.format()
@@ -1010,8 +1009,7 @@
"""Return the prefix to be prepended to server-side fragmented
messages"""
routingType, routingInfo, _ = self.getRouting()
- return mixminion.Packet.ServerSideFragmentedMessage(
- routingType, routingInfo, "").pack()
+ return ServerSideFragmentedMessage(routingType, routingInfo, "").pack()
def setFragmented(self, isSSFragmented, nFragments):
"""Set the fragmentation parameters of this exit address
Index: ClientMain.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/ClientMain.py,v
retrieving revision 1.145
retrieving revision 1.146
diff -u -d -r1.145 -r1.146
--- ClientMain.py 3 Jan 2004 05:45:26 -0000 1.145
+++ ClientMain.py 3 Jan 2004 07:35:23 -0000 1.146
@@ -1,4 +1,4 @@
-# Copyright 2002-2003 Nick Mathewson. See LICENSE for licensing information.
+# Copyright 2002-2004 Nick Mathewson. See LICENSE for licensing information.
# Id: ClientMain.py,v 1.89 2003/06/05 18:41:40 nickm Exp $
"""mixminion.ClientMain
@@ -21,7 +21,6 @@
import mixminion.Crypto
import mixminion.Filestore
import mixminion.MMTPClient
-import mixminion.ServerInfo
from mixminion.Common import LOG, Lockfile, LockfileLocked, MixError, \
MixFatalError, MixProtocolBadAuth, MixProtocolError, UIError, \
@@ -29,9 +28,9 @@
stringContains, succeedingMidnight, writeFile, previousMidnight, floorDiv
from mixminion.Packet import encodeMailHeaders, ParseError, parseMBOXInfo, \
parseReplyBlocks, parseSMTPInfo, parseTextEncodedMessages, \
- parseTextReplyBlocks, ReplyBlock, MBOX_TYPE, SMTP_TYPE, DROP_TYPE, \
- parseMessageAndHeaders
-from mixminion.ServerInfo import displayServer
+ parseTextReplyBlocks, ReplyBlock, parseMessageAndHeaders
+
+from mixminion.ServerInfo import displayServer, ServerInfo
#----------------------------------------------------------------------
# Global variable; holds an instance of Common.Lockfile used to prevent
@@ -225,7 +224,7 @@
"""
d = {}
for packet, firstHop in packets:
- if isinstance(firstHop, mixminion.ServerInfo.ServerInfo):
+ if isinstance(firstHop, ServerInfo):
ri = firstHop.getRoutingInfo()
else:
assert (isinstance(firstHop, mixminion.Packet.MMTPHostInfo) or
@@ -1353,8 +1352,7 @@
listFeatures = 1
if listFeatures:
- features = mixminion.Config.getFeatureList(
- mixminion.ServerInfo.ServerInfo)
+ features = mixminion.Config.getFeatureList(ServerInfo)
features.append(("caps",))
features.append(("status",))
for f in features:
Index: ClientUtils.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/ClientUtils.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- ClientUtils.py 3 Jan 2004 05:45:26 -0000 1.15
+++ ClientUtils.py 3 Jan 2004 07:35:23 -0000 1.16
@@ -1,4 +1,4 @@
-# Copyright 2002-2003 Nick Mathewson. See LICENSE for licensing information.
+# Copyright 2002-2004 Nick Mathewson. See LICENSE for licensing information.
# Id: ClientMain.py,v 1.89 2003/06/05 18:41:40 nickm Exp $
"""mixminion.ClientUtils
@@ -376,9 +376,9 @@
# surbKeys: A map from lowercase keyid to a list of (expiry-time, secret)
# for all of the SURB keys in the keyring.
SURB_KEY_TYPE = 0x00
- def __init__(self, input="", now=None):
+ def __init__(self, s="", now=None):
"""Initialize this keyring representation from the encoded string
- 'input'. If any keys are set to expire before 'now', delete them.
+ 's'. If any keys are set to expire before 'now', delete them.
"""
if now is None: now = time.time()
@@ -386,18 +386,18 @@
self.unrecognized = []
rec = []
self.dirty = 0
- while input:
- if len(input) < 3:
+ while s:
+ if len(s) < 3:
raise MixError("Corrupt keyring: truncated entry.")
- tp,length = struct.unpack("!BH", input[:3])
- if len(input) < 3+length:
+ tp,length = struct.unpack("!BH", s[:3])
+ if len(s) < 3+length:
raise MixError("Corrupt keyring: truncated entry.")
- val = input[3:3+length]
+ val = s[3:3+length]
if tp == self.SURB_KEY_TYPE:
rec.append((tp,val))
else:
self.unrecognized.append((tp,val))
- input = input[3+length:]
+ s = s[3+length:]
# Now, extract all the SURB keys from the keyring, and remove all
# expired SURB keys from self.recognized.
Index: Common.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/Common.py,v
retrieving revision 1.126
retrieving revision 1.127
diff -u -d -r1.126 -r1.127
--- Common.py 3 Jan 2004 05:45:26 -0000 1.126
+++ Common.py 3 Jan 2004 07:35:23 -0000 1.127
@@ -1,4 +1,4 @@
-# Copyright 2002-2003 Nick Mathewson. See LICENSE for licensing information.
+# Copyright 2002-2004 Nick Mathewson. See LICENSE for licensing information.
# $Id$
"""mixminion.Common
@@ -1124,10 +1124,10 @@
self.nUnits = seconds
def __str__(self):
- s = ""
+ plural = ""
if self.nUnits != 1:
- s = "s"
- return "%s %s%s" % (self.nUnits, self.unitName, s)
+ plural = "s"
+ return "%s %s%s" % (self.nUnits, self.unitName, plural)
def __repr__(self):
return "Duration(%r, %r, %r)" % (self.seconds, self.unitName,
@@ -1633,3 +1633,5 @@
raise
delay = min(delay*2,remaining,0.2)
_sleep(delay)
+
+ raise AssertionError # unreached, appease pychecker
Index: Config.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/Config.py,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -d -r1.73 -r1.74
--- Config.py 3 Jan 2004 05:45:26 -0000 1.73
+++ Config.py 3 Jan 2004 07:35:23 -0000 1.74
@@ -1,4 +1,4 @@
-# Copyright 2002-2003 Nick Mathewson. See LICENSE for licensing information.
+# Copyright 2002-2004 Nick Mathewson. See LICENSE for licensing information.
# $Id$
"""Configuration file parsers for Mixminion client and server
@@ -61,8 +61,6 @@
except ImportError:
pwd = None
-from cStringIO import StringIO
-
import mixminion.Common
import mixminion.Crypto
import mixminion.NetUtils
Index: Crypto.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/Crypto.py,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- Crypto.py 3 Jan 2004 05:45:26 -0000 1.60
+++ Crypto.py 3 Jan 2004 07:35:23 -0000 1.61
@@ -1,4 +1,4 @@
-# Copyright 2002-2003 Nick Mathewson. See LICENSE for licensing information.
+# Copyright 2002-2004 Nick Mathewson. See LICENSE for licensing information.
# $Id$
"""mixminion.Crypto
Index: Filestore.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/Filestore.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- Filestore.py 3 Jan 2004 05:45:26 -0000 1.16
+++ Filestore.py 3 Jan 2004 07:35:23 -0000 1.17
@@ -1,4 +1,4 @@
-# Copyright 2002-2003 Nick Mathewson. See LICENSE for licensing information.
+# Copyright 2002-2004 Nick Mathewson. See LICENSE for licensing information.
# $Id$
"""mixminion.Filestore
Index: Fragments.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/Fragments.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- Fragments.py 28 Nov 2003 04:14:04 -0000 1.10
+++ Fragments.py 3 Jan 2004 07:35:23 -0000 1.11
@@ -1,4 +1,4 @@
-# Copyright 2002-2003 Nick Mathewson. See LICENSE for licensing information.
+# Copyright 2002-2004 Nick Mathewson. See LICENSE for licensing information.
# $Id$
"""mixminion.BuildMessage
@@ -126,7 +126,7 @@
old messages in 'dir_db'.
"""
self.store = mixminion.Filestore.StringMetadataStore(
- dir,create=1,scrub=1)
+ dir,create=1)
self.db = FragmentDB(dir+"_db")
self.rescan()
Index: MMTPClient.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/MMTPClient.py,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- MMTPClient.py 3 Jan 2004 05:45:26 -0000 1.46
+++ MMTPClient.py 3 Jan 2004 07:35:23 -0000 1.47
@@ -19,7 +19,6 @@
import time
import mixminion._minionlib as _ml
import mixminion.NetUtils
-import mixminion.Packet
import mixminion.ServerInfo
import mixminion.TLSConnection
from mixminion.Crypto import sha1, getCommonPRNG
@@ -27,7 +26,6 @@
MixProtocolBadAuth, LOG, MixError, formatBase64, TimeoutError
from mixminion.Packet import IPV4Info, MMTPHostInfo
-
def _noop(*k,**v): pass
class EventStatsDummy:
def __getattr__(self,a):
@@ -42,8 +40,6 @@
class DeliverableMessage:
"""Interface to be implemented by messages deliverable by MMTP"""
- def __init__(self):
- pass
def getContents(self):
raise NotImplementedError
def isJunk(self):
@@ -95,7 +91,7 @@
context = _ml.TLSContext_new()
if serverName is None:
serverName = mixminion.ServerInfo.displayServer(
- mixminion.Packet.IPV4Info(targetAddr, targetPort, targetKeyID))
+ IPV4Info(targetAddr, targetPort, targetKeyID))
if certCache is None:
certCache = PeerCertificateCache()
@@ -428,8 +424,8 @@
# Use select to run the connection until it's done.
import select
fd = con.fileno()
- wr,ww,open = con.getStatus()
- while open:
+ wr,ww,isopen = con.getStatus()
+ while isopen:
if wr:
rfds = [fd]
else:
@@ -445,8 +441,8 @@
rfds,wfds,xfds=select.select(rfds,wfds,xfds,3)
now = time.time()
- wr,ww,open=con.process(fd in rfds, fd in wfds)
- if open:
+ wr,ww,isopen=con.process(fd in rfds, fd in wfds)
+ if isopen:
con.tryTimeout(now-timeout)
# If anything wasn't delivered, raise MixProtocolError.
@@ -464,7 +460,7 @@
May raise MixProtocolBadAuth, or other MixProtocolError if server
isn't up."""
- sendPackets(routing, ["JUNK"], connectTimeout=timeout)
+ sendPackets(routing, ["JUNK"], timeout=timeout)
class PeerCertificateCache:
"""A PeerCertificateCache validates certificate chains from MMTP servers,
Index: Packet.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/Packet.py,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- Packet.py 3 Jan 2004 05:45:26 -0000 1.70
+++ Packet.py 3 Jan 2004 07:35:23 -0000 1.71
@@ -1,4 +1,4 @@
-# Copyright 2002-2003 Nick Mathewson. See LICENSE for licensing information.
+# Copyright 2002-2004 Nick Mathewson. See LICENSE for licensing information.
# $Id$
"""mixminion.Packet
Index: ServerInfo.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/ServerInfo.py,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- ServerInfo.py 3 Jan 2004 05:45:26 -0000 1.70
+++ ServerInfo.py 3 Jan 2004 07:35:23 -0000 1.71
@@ -1,4 +1,4 @@
-# Copyright 2002-2003 Nick Mathewson. See LICENSE for licensing information.
+# Copyright 2002-2004 Nick Mathewson. See LICENSE for licensing information.
# $Id$
"""mixminion.ServerInfo
@@ -15,15 +15,14 @@
import types
import mixminion.Config
-import mixminion.Crypto
import mixminion.MMTPClient
import mixminion.Packet
from mixminion.Common import IntervalSet, LOG, MixError, createPrivateDir, \
- formatBase64, formatDate, formatTime, readPossiblyGzippedFile
+ formatBase64, formatDate, formatTime, readPossiblyGzippedFile
from mixminion.Config import ConfigError
-from mixminion.Packet import IPV4Info, MMTPHostInfo
-from mixminion.Crypto import CryptoError, DIGEST_LEN, pk_check_signature
+from mixminion.Crypto import CryptoError, DIGEST_LEN, pk_check_signature, \
+ pk_encode_public_key, pk_sign, sha1
# Longest allowed Contact email
MAX_CONTACT = 256
@@ -327,8 +326,7 @@
def getKeyDigest(self):
"""Returns a hash of this server's MMTP key"""
- return mixminion.Crypto.sha1(
- mixminion.Crypto.pk_encode_public_key(self['Server']['Identity']))
+ return sha1(pk_encode_public_key(self['Server']['Identity']))
def getIPV4Info(self):
"""Returns a mixminion.Packet.IPV4Info object for routing messages
@@ -336,7 +334,7 @@
or earlier.)"""
ip = self.getIP()
if ip is None: return None
- return IPV4Info(ip, self.getPort(), self.getKeyDigest())
+ return mixminion.Packet.IPV4Info(ip, self.getPort(), self.getKeyDigest())
def getMMTPHostInfo(self):
"""Returns a mixminion.Packet.MMTPHostInfo object for routing messages
@@ -344,7 +342,8 @@
or later.)"""
host = self.getHostname()
if host is None: return None
- return MMTPHostInfo(host, self.getPort(), self.getKeyDigest())
+ return mixminion.Packet.MMTPHostInfo(
+ host, self.getPort(), self.getKeyDigest())
def getRoutingInfo(self):
"""Return whichever of MMTPHostInfo or IPV4 info is best for
@@ -696,12 +695,12 @@
s = m.group(0)
return s[:s.index(':')+1]
info = regex.sub(replaceFn, info, 2)
- digest = mixminion.Crypto.sha1(info)
+ digest = sha1(info)
if rsa is None:
return digest
- signature = mixminion.Crypto.pk_sign(digest,rsa)
+ signature = pk_sign(digest,rsa)
digest = formatBase64(digest)
signature = formatBase64(signature)
def replaceFn2(s, digest=digest, signature=signature,
Index: TLSConnection.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/TLSConnection.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- TLSConnection.py 3 Jan 2004 05:58:54 -0000 1.1
+++ TLSConnection.py 3 Jan 2004 07:35:23 -0000 1.2
@@ -194,6 +194,8 @@
self.inbuflen -= maxBytes
return r
+ raise AssertionError # unreached; appease pychecker
+
def getInbufLine(self, maxBytes=None, terminator="\r\n", clear=0,
allowExtra=0):
"""Return the first prefix of the current inbuf that ends with the
Index: benchmark.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/benchmark.py,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- benchmark.py 12 Dec 2003 22:37:13 -0000 1.50
+++ benchmark.py 3 Jan 2004 07:35:23 -0000 1.51
@@ -1,4 +1,4 @@
-# Copyright 2002-2003 Nick Mathewson. See LICENSE for licensing information.
+# Copyright 2002-2004 Nick Mathewson. See LICENSE for licensing information.
# $Id$
"""mixminion.benchmark
@@ -99,7 +99,6 @@
short = "Hello, Dali!"
s20b = "ABCDEFGHIJKLMNOPQRST"
s64b = "8charstr"*8
-s128b = s64b*2
s70b = "10character"*7
s1K = "8charstr"*128
s2K = s1K*2
@@ -108,8 +107,6 @@
s28K = s1K*28
s32K = s8K*4
-s120b = 'z'*120
-
def cryptoTiming():
print "#==================== CRYPTO ======================="
@@ -345,23 +342,23 @@
print "Add entry (up to %s entries)" %load, timestr(t/float(load))
t = time()
- for hash in hashes[0:1000]:
- h.seenHash(hash)
+ for hash_ in hashes[0:1000]:
+ h.seenHash(hash_)
t = time()-t
print "Check entry [hit] (%s entries)" %load, timestr(t/1000.0)
hashes =[ prng.getBytes(20) for _ in xrange(1000) ]
t = time()
- for hash in hashes:
- h.seenHash(hash)
+ for hash_ in hashes:
+ h.seenHash(hash_)
t = time()-t
print "Check entry [miss] (%s entries)" %load, timestr(t/1000.0)
hashes =[ prng.getBytes(20) for _ in xrange(1000) ]
t = time()
- for hash in hashes:
- h.seenHash(hash)
- h.logHash(hash)
+ for hash_ in hashes:
+ h.seenHash(hash_)
+ h.logHash(hash_)
t = time()-t
print "Check entry [miss+add] (%s entries)" %load, timestr(t/1000.0)
@@ -724,8 +721,8 @@
lst = [ os.path.join(dname,str(i)) for i in range(100,200) ]
t1 = time()
- for file in lst:
- secureDelete(file)
+ for fname in lst:
+ secureDelete(fname)
t = time()-t1
print "secureDelete (1)", timestr(t/100)
Index: test.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/test.py,v
retrieving revision 1.172
retrieving revision 1.173
diff -u -d -r1.172 -r1.173
--- test.py 3 Jan 2004 05:45:26 -0000 1.172
+++ test.py 3 Jan 2004 07:35:23 -0000 1.173
@@ -260,7 +260,7 @@
def testVersions(self):
vstr = mixminion.version_tuple_to_string
parse = mixminion.parse_version_string
- cmp = mixminion.cmp_versions
+ cmp_v = mixminion.cmp_versions
last = None
for t,s,c in [((1,0,0,100,-1), "1.0.0", None),
((0,0,3,0,-1), "0.0.3alpha", '<'),
@@ -284,11 +284,11 @@
if c == 'EX':
self.assertRaises(ValueError, cmp, last, t)
elif c == '<':
- self.assertEquals(cmp(last,t), -1)
+ self.assertEquals(cmp_v(last,t), -1)
elif c == '=':
- self.assertEquals(cmp(last,t), 0)
+ self.assertEquals(cmp_v(last,t), 0)
elif c == '>':
- self.assertEquals(cmp(last,t), 1)
+ self.assertEquals(cmp_v(last,t), 1)
else:
print "Huh?"
@@ -620,11 +620,11 @@
d64 = encodeBase64(longish, lineWidth=64)
self.assertEquals(longish, base64.decodestring(d32))
self.assertEquals(longish, base64.decodestring(d64))
- for enc, max in ((d32, 33), (d64,65)):
+ for enc, maxlen in ((d32, 33), (d64,65)):
lines = enc.split("\n")
for line in lines[-1]:
- self.assertEquals(len(line), max)
- self.assert_(len(lines[-1]) <= max)
+ self.assertEquals(len(line), maxlen)
+ self.assert_(len(lines[-1]) <= maxlen)
def test_armor(self):
inp1 = "xyzzy111"*10
@@ -6480,7 +6480,6 @@
cq = CQ(d)
p1 = "Z"*(32*1024)
p2 = mixminion.Crypto.getCommonPRNG().getBytes(32*1024)
- p3 = p2[:1024]*32
ipv4 = mixminion.Packet.IPV4Info("10.20.30.40",48099,"KZ"*10)
host = mixminion.Packet.MMTPHostInfo("bliznerty.potrzebie",48099,
"KZ"*10)
@@ -7181,9 +7180,6 @@
# Now try with some servers...
edesc = getExampleServerDescriptors()
ServerInfo = mixminion.ServerInfo.ServerInfo
- Lola = ServerInfo(string=edesc["Lola"][1], assumeValid=1)
- Joe = ServerInfo(string=edesc["Joe"][0], assumeValid=1)
- Alice = ServerInfo(string=edesc["Alice"][1], assumeValid=1)
# ... and for now, we need to restart the client.
client = mixminion.ClientMain.MixminionClient(usercfg)
@@ -7260,26 +7256,6 @@
for i in xrange(len(packetList)):
callback(i)
- class FakeBCC:
- PROTOCOL_VERSIONS=["0.3"]
- def __init__(self, family, addr, port, keyid, serverName=None):
- global BCC_INSTANCE
- BCC_INSTANCE = self
- self.family = family
- self.addr = addr
- self.port = port
- self.keyid = keyid
- self.packets = []
- self.connected = 0
- def connect(self, connectTimeout):
- self.connected = 1
- self.timeout = connectTimeout
- def sendPacket(self, msg):
- assert self.connected
- self.packets.append(msg)
- def shutdown(self):
- self.connected = 0
-
replaceAttribute(mixminion.MMTPClient, "sendPackets", fakeSendPackets)
overrideDNS({'alice' : "10.0.0.100"})
try:
@@ -7461,6 +7437,7 @@
pool.addFragment(pkts3[60])
finally:
s = resumeLog()
+
self.assert_(stringContains(s, "Found inconsistent fragment"))
self.assertEquals(pool.store.count(), 4+4)
for i in xrange(40,55):
@@ -7518,7 +7495,7 @@
tc = loader.loadTestsFromTestCase
if 0:
- suite.addTest(tc(ClientMainTests))
+ suite.addTest(tc(FragmentTests))
return suite
testClasses = [MiscTests,
MinionlibCryptoTests,
Index: testSupport.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/testSupport.py,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- testSupport.py 28 Nov 2003 04:14:04 -0000 1.23
+++ testSupport.py 3 Jan 2004 07:35:23 -0000 1.24
@@ -1,4 +1,4 @@
-# Copyright 2002-2003 Nick Mathewson. See LICENSE for licensing information.
+# Copyright 2002-2004 Nick Mathewson. See LICENSE for licensing information.
# $Id$
"""mixminion.testSupport
@@ -66,11 +66,7 @@
if not os.path.exists(self.loc):
createPrivateDir(self.loc)
- max = -1
- for f in os.listdir(self.loc):
- if int(f) > max:
- max = int(f)
- self.next = max+1
+ self.next = 1 + max([-1]+[int(f) for f in os.listdir(self.loc)])
self.retry = config['Testing/DirectoryDump']['Retry']
manager.enableModule(self)