]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
dirnode: cleanup, make get_verifier() always return a URI instance, not a string
authorBrian Warner <warner@lothar.com>
Wed, 10 Sep 2008 08:37:55 +0000 (01:37 -0700)
committerBrian Warner <warner@lothar.com>
Wed, 10 Sep 2008 08:37:55 +0000 (01:37 -0700)
src/allmydata/dirnode.py
src/allmydata/test/test_dirnode.py

index 71aa61d7d07ae7a9ce036ae6cc686e89bb5c6892..14cabdf761f6fa9c63cb1be98cfc9bdd2996a9bf 100644 (file)
@@ -242,7 +242,7 @@ class NewDirectoryNode:
         return self._uri.get_readonly().to_string()
 
     def get_verifier(self):
-        return self._uri.get_verifier().to_string()
+        return self._uri.get_verifier()
 
     def get_storage_index(self):
         return self._uri._filenode_uri.storage_index
index 517bd6b4da93a55496a528f46389b9c252feb0bd..621665a40cb383ddc9b352afaaedb64fe7a17245 100644 (file)
@@ -25,8 +25,7 @@ class Marker:
         self.nodeuri = nodeuri
         si = hashutil.tagged_hash("tag1", nodeuri)[:16]
         fp = hashutil.tagged_hash("tag2", nodeuri)
-        self.verifieruri = uri.SSKVerifierURI(storage_index=si,
-                                              fingerprint=fp).to_string()
+        self.verifieruri = uri.SSKVerifierURI(storage_index=si, fingerprint=fp)
     def get_uri(self):
         return self.nodeuri
     def get_readonly_uri(self):
@@ -279,7 +278,7 @@ class Dirnode(unittest.TestCase, testutil.ShouldFailMixin, testutil.StallMixin):
             self.failUnless(u.startswith("URI:DIR2:"), u)
             u_ro = n.get_readonly_uri()
             self.failUnless(u_ro.startswith("URI:DIR2-RO:"), u_ro)
-            u_v = n.get_verifier()
+            u_v = n.get_verifier().to_string()
             self.failUnless(u_v.startswith("URI:DIR2-Verifier:"), u_v)
             self.expected_manifest.append(u_v)
             expected_si = n._uri._filenode_uri.storage_index
@@ -292,8 +291,7 @@ class Dirnode(unittest.TestCase, testutil.ShouldFailMixin, testutil.StallMixin):
             fake_file_uri = make_mutable_file_uri()
             other_file_uri = make_mutable_file_uri()
             m = Marker(fake_file_uri)
-            ffu_v = m.get_verifier()
-            assert isinstance(ffu_v, str)
+            ffu_v = m.get_verifier().to_string()
             self.expected_manifest.append(ffu_v)
             d.addCallback(lambda res: n.set_uri(u"child", fake_file_uri))
             d.addCallback(lambda res:
@@ -312,7 +310,7 @@ class Dirnode(unittest.TestCase, testutil.ShouldFailMixin, testutil.StallMixin):
             def _created(subdir):
                 self.failUnless(isinstance(subdir, FakeDirectoryNode))
                 self.subdir = subdir
-                new_v = subdir.get_verifier()
+                new_v = subdir.get_verifier().to_string()
                 assert isinstance(new_v, str)
                 self.expected_manifest.append(new_v)
             d.addCallback(_created)