From 50deed52a2684f71c1aed988373c44f5960d8877 Mon Sep 17 00:00:00 2001 From: Leif Ryge Date: Sat, 27 Apr 2013 08:03:18 +0000 Subject: [PATCH] fix tests --- src/allmydata/storage_client.py | 2 +- src/allmydata/test/test_client.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/allmydata/storage_client.py b/src/allmydata/storage_client.py index 4a6d6928..48da07a6 100644 --- a/src/allmydata/storage_client.py +++ b/src/allmydata/storage_client.py @@ -62,7 +62,7 @@ class StorageFarmBroker: I'm also responsible for subscribing to the IntroducerClient to find out about new servers as they are announced by the Introducer. """ - def __init__(self, tub, permute_peers, preferred_peers): + def __init__(self, tub, permute_peers, preferred_peers=()): self.tub = tub assert permute_peers # False not implemented yet self.permute_peers = permute_peers diff --git a/src/allmydata/test/test_client.py b/src/allmydata/test/test_client.py index 104f064f..310899cb 100644 --- a/src/allmydata/test/test_client.py +++ b/src/allmydata/test/test_client.py @@ -6,7 +6,7 @@ import allmydata from allmydata.node import Node, OldConfigError, OldConfigOptionError, MissingConfigEntry, UnescapedHashError from allmydata import client from allmydata.storage_client import StorageFarmBroker -from allmydata.util import base32, fileutil, idlib +from allmydata.util import base32, fileutil from allmydata.interfaces import IFilesystemNode, IFileNode, \ IImmutableFileNode, IMutableFileNode, IDirectoryNode from foolscap.api import flushEventualQueue @@ -177,7 +177,7 @@ class Basic(testutil.ReallyEqualMixin, unittest.TestCase): return [ s.get_longname() for s in sb.get_servers_for_psi(key) ] def test_permute(self): - sb = StorageFarmBroker(None, True, []) + sb = StorageFarmBroker(None, True) for k in ["%d" % i for i in range(5)]: ann = {"anonymous-storage-FURL": "pb://abcde@nowhere/fake", "permutation-seed-base32": base32.b2a(k) } @@ -189,9 +189,11 @@ class Basic(testutil.ReallyEqualMixin, unittest.TestCase): self.failUnlessReallyEqual(self._permute(sb, "one"), []) def test_permute_with_preferred(self): - sb = StorageFarmBroker(None, True, map(idlib.nodeid_b2a, ['1','4'])) + sb = StorageFarmBroker(None, True, ['1','4']) for k in ["%d" % i for i in range(5)]: - sb.test_add_rref(k, "rref") + ann = {"anonymous-storage-FURL": "pb://abcde@nowhere/fake", + "permutation-seed-base32": base32.b2a(k) } + sb.test_add_rref(k, "rref", ann) self.failUnlessReallyEqual(self._permute(sb, "one"), ['1','4','3','0','2']) self.failUnlessReallyEqual(self._permute(sb, "two"), ['4','1','0','2','3']) -- 2.45.2