From f6eeb3161f4a967d90a570e56fee44d35aaff692 Mon Sep 17 00:00:00 2001
From: Brian Warner <warner@lothar.com>
Date: Wed, 10 Sep 2008 01:37:55 -0700
Subject: [PATCH] dirnode: cleanup, make get_verifier() always return a URI
 instance, not a string

---
 src/allmydata/dirnode.py           |  2 +-
 src/allmydata/test/test_dirnode.py | 10 ++++------
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/allmydata/dirnode.py b/src/allmydata/dirnode.py
index 71aa61d7..14cabdf7 100644
--- a/src/allmydata/dirnode.py
+++ b/src/allmydata/dirnode.py
@@ -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
diff --git a/src/allmydata/test/test_dirnode.py b/src/allmydata/test/test_dirnode.py
index 517bd6b4..621665a4 100644
--- a/src/allmydata/test/test_dirnode.py
+++ b/src/allmydata/test/test_dirnode.py
@@ -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)
-- 
2.45.2