]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
mutable: add basic test coverage of new-dirnodes-using-mutable-files
authorBrian Warner <warner@lothar.com>
Thu, 8 Nov 2007 11:31:00 +0000 (04:31 -0700)
committerBrian Warner <warner@lothar.com>
Thu, 8 Nov 2007 11:31:00 +0000 (04:31 -0700)
src/allmydata/mutable.py
src/allmydata/test/test_system.py

index 89422e9da27a00694de11f1f97ad5e77e557bc8d..20b0429a21300377bd5fd0a20c397834176abc60 100644 (file)
@@ -1264,6 +1264,9 @@ class MutableFileNode:
 
     def is_mutable(self):
         return self._uri.is_mutable()
+    def is_readonly(self):
+        # but maybe not you
+        return self._uri.is_readonly()
 
     def __hash__(self):
         return hash((self.__class__, self.uri))
index 6c309d1154a0d4c7127b60de2b9e00b3a2c77f47..2616189394bfbaed0d4443cba7626246da943164 100644 (file)
@@ -378,8 +378,26 @@ class SystemTest(testutil.SignalMixin, unittest.TestCase):
         def _check_download_5(res):
             log.msg("finished replace2")
             self.failUnlessEqual(res, NEWERDATA)
+            # make sure we can create empty files, this usually screws up the
+            # segsize math
+            d1 = self.clients[2].create_mutable_file("")
+            d1.addCallback(lambda newnode: newnode.download_to_data())
+            d1.addCallback(lambda res: self.failUnlessEqual("", res))
+            return d1
         d.addCallback(_check_download_5)
 
+        d.addCallback(lambda res: self.clients[0].create_empty_dirnode())
+        def _created_dirnode(dnode):
+            d1 = dnode.list()
+            d1.addCallback(lambda children: self.failUnlessEqual(children, {}))
+            d1.addCallback(lambda res: dnode.has_child("edgar"))
+            d1.addCallback(lambda answer: self.failUnlessEqual(answer, False))
+            d1.addCallback(lambda res: dnode.set_node("see recursive", dnode))
+            d1.addCallback(lambda res: dnode.has_child("see recursive"))
+            d1.addCallback(lambda answer: self.failUnlessEqual(answer, True))
+            return d1
+        d.addCallback(_created_dirnode)
+
         return d
 
     def flip_bit(self, good):