fix tests
authorLeif Ryge <leif@synthesize.us>
Sat, 27 Apr 2013 08:03:18 +0000 (08:03 +0000)
committerLeif Ryge <leif@synthesize.us>
Sat, 22 Nov 2014 20:01:12 +0000 (20:01 +0000)
src/allmydata/storage_client.py
src/allmydata/test/test_client.py

index 4a6d6928b37cdfdbe26d7bc5c7c08dda3b8beb27..48da07a69db91e6cd99988bceccc0110dc13bbfb 100644 (file)
@@ -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
index 104f064f135a746a6d32598c3f402ea8876ea294..310899cbd4a4c894196df54b4a8b75aed25c2e2b 100644 (file)
@@ -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'])