]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
editing: change names like "MyThing" to "FakeThing" for fake objects in unit tests
authorZooko O'Whielacronx <zooko@zooko.com>
Wed, 12 Dec 2007 01:10:29 +0000 (18:10 -0700)
committerZooko O'Whielacronx <zooko@zooko.com>
Wed, 12 Dec 2007 01:10:29 +0000 (18:10 -0700)
src/allmydata/test/test_client.py
src/allmydata/test/test_dirnode.py
src/allmydata/test/test_introducer.py

index fd76ce088fb4d8b4bd9aef006c506fd55d4d6f42..f199bcdda2da0f0e2aa31a63df5690cbbab749a4 100644 (file)
@@ -9,7 +9,7 @@ from allmydata import client, introducer
 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 = {}
 
@@ -99,7 +99,7 @@ class Basic(unittest.TestCase):
         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'])
@@ -108,7 +108,7 @@ class Basic(unittest.TestCase):
         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'])
index 07bef1a079da7c210655d0cd9a4e264d78303f28..0e945c5441e93c36259f3bba811af6a73bddf6ef 100644 (file)
@@ -12,7 +12,7 @@ from allmydata.test.common import make_chk_file_uri, make_mutable_file_uri, \
 # 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
@@ -52,11 +52,11 @@ class FakeClient:
         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
@@ -69,7 +69,7 @@ class Dirnode(unittest.TestCase, testutil.ShouldFailMixin):
     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)
@@ -182,7 +182,7 @@ class Dirnode(unittest.TestCase, testutil.ShouldFailMixin):
 
             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)
@@ -206,7 +206,7 @@ class Dirnode(unittest.TestCase, testutil.ShouldFailMixin):
             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()))
index 0c521222edadbb82fad0cfc86a0b3eb11c3aba58..0e1831bfa7f21696f12bd1db7245860d6cf4d348 100644 (file)
@@ -12,7 +12,7 @@ from twisted.application import service
 from allmydata.introducer import IntroducerClient, IntroducerService, IntroducerNode
 from allmydata.util import testutil
 
-class MyNode(Referenceable):
+class FakeNode(Referenceable):
     pass
 
 class LoggingMultiService(service.MultiService):
@@ -101,7 +101,7 @@ class TestIntroducer(unittest.TestCase, testutil.PollMixin):
             portnum = l.getPortnum()
             tub.setLocation("localhost:%d" % portnum)
 
-            n = MyNode()
+            n = FakeNode()
             node_furl = tub.registerReference(n)
             c = IntroducerClient(tub, iurl, node_furl)
 
@@ -205,7 +205,7 @@ class TestIntroducer(unittest.TestCase, testutil.PollMixin):
 
         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)
@@ -246,7 +246,7 @@ class TestIntroducer(unittest.TestCase, testutil.PollMixin):
             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)