from allmydata.util import version_class, idlib
from foolscap.eventual import flushEventualQueue
-class MyIntroducerClient(introducer.IntroducerClient):
+class FakeIntroducerClient(introducer.IntroducerClient):
def __init__(self):
self.connections = {}
open(os.path.join(basedir, "introducer.furl"), "w").write("")
open(os.path.join(basedir, "vdrive.furl"), "w").write("")
c = client.Client(basedir)
- c.introducer_client = MyIntroducerClient()
+ c.introducer_client = FakeIntroducerClient()
for k in ["%d" % i for i in range(5)]:
c.introducer_client.connections[k] = None
self.failUnlessEqual(permute(c, "one"), ['3','1','0','4','2'])
self.failUnlessEqual(permute(c, "one"), [])
c2 = client.Client(basedir)
- c2.introducer_client = MyIntroducerClient()
+ c2.introducer_client = FakeIntroducerClient()
for k in ["%d" % i for i in range(5)]:
c2.introducer_client.connections[k] = None
self.failUnlessEqual(permute(c2, "one"), ['3','1','0','4','2'])
# contain pointers to fake files. We start with a fake MutableFileNode that
# stores all of its data in a static table.
-MyDirectoryNode = NonGridDirectoryNode
+FakeDirectoryNode = NonGridDirectoryNode
class Marker:
implements(IFileNode, IMutableFileNode) # sure, why not
u = IURI(u)
if (INewDirectoryURI.providedBy(u)
or IReadonlyNewDirectoryURI.providedBy(u)):
- return MyDirectoryNode(self).init_from_uri(u)
+ return FakeDirectoryNode(self).init_from_uri(u)
return Marker(u.to_string())
def create_empty_dirnode(self, wait_for_numpeers):
- n = MyDirectoryNode(self)
+ n = FakeDirectoryNode(self)
d = n.create(wait_for_numpeers)
d.addCallback(lambda res: n)
return d
def test_basic(self):
d = self.client.create_empty_dirnode(0)
def _done(res):
- self.failUnless(isinstance(res, MyDirectoryNode))
+ self.failUnless(isinstance(res, FakeDirectoryNode))
rep = str(res)
self.failUnless("RW" in rep)
d.addCallback(_done)
d.addCallback(lambda res: n.create_empty_directory("subdir", wait_for_numpeers=1))
def _created(subdir):
- self.failUnless(isinstance(subdir, MyDirectoryNode))
+ self.failUnless(isinstance(subdir, FakeDirectoryNode))
self.subdir = subdir
new_v = subdir.get_verifier()
assert isinstance(new_v, str)
d.addCallback(lambda res: n.get_child_at_path("subdir/subsubdir"))
d.addCallback(lambda subsubdir:
self.failUnless(isinstance(subsubdir,
- MyDirectoryNode)))
+ FakeDirectoryNode)))
d.addCallback(lambda res: n.get_child_at_path(""))
d.addCallback(lambda res: self.failUnlessEqual(res.get_uri(),
n.get_uri()))
from allmydata.introducer import IntroducerClient, IntroducerService, IntroducerNode
from allmydata.util import testutil
-class MyNode(Referenceable):
+class FakeNode(Referenceable):
pass
class LoggingMultiService(service.MultiService):
portnum = l.getPortnum()
tub.setLocation("localhost:%d" % portnum)
- n = MyNode()
+ n = FakeNode()
node_furl = tub.registerReference(n)
c = IntroducerClient(tub, iurl, node_furl)
clients = []
for i in range(5):
- n = MyNode()
+ n = FakeNode()
node_furl = tub.registerReference(n)
c = IntroducerClient(tub, iurl, node_furl)
c.setServiceParent(self.parent)
portnum = l.getPortnum()
tub.setLocation("localhost:%d" % portnum)
- n = MyNode()
+ n = FakeNode()
node_furl = tub.registerReference(n)
c = IntroducerClient(tub, iurl, node_furl)
c.setServiceParent(self.parent)