]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
ImmutableDirectoryURIVerifier: fix verifycap handling
authorBrian Warner <warner@lothar.com>
Wed, 18 Nov 2009 16:42:38 +0000 (08:42 -0800)
committerBrian Warner <warner@lothar.com>
Wed, 18 Nov 2009 16:42:38 +0000 (08:42 -0800)
src/allmydata/test/test_uri.py
src/allmydata/uri.py

index 9a2143ef85badff6acac9aa92dc698bb0a78e7d7..142606167bdb7cf5db5fe1fccf77edb3fab2fe5e 100644 (file)
@@ -362,12 +362,18 @@ class NewDirnode(unittest.TestCase):
 
         u2_verifier = u2.get_verify_cap()
         self.failUnless(isinstance(u2_verifier,
-                                   uri.ImmutableDirectoryURIVerifier), u2_verifier)
+                                   uri.ImmutableDirectoryURIVerifier),
+                        u2_verifier)
         self.failUnless(IVerifierURI.providedBy(u2_verifier))
+        u2vs = u2_verifier.to_string()
+        # URI:DIR2-CHK-Verifier:$key:$ueb:$k:$n:$size
+        self.failUnless(u2vs.startswith("URI:DIR2-CHK-Verifier:"), u2vs)
         u2_verifier_fileuri = u2_verifier.get_filenode_cap()
         self.failUnless(IVerifierURI.providedBy(u2_verifier_fileuri))
-        self.failUnlessEqual(u2_verifier_fileuri.to_string(),
-                             fnuri.get_verify_cap().to_string())
+        u2vfs = u2_verifier_fileuri.to_string()
+        # URI:CHK-Verifier:$key:$ueb:$k:$n:$size
+        self.failUnlessEqual(u2vfs, fnuri.get_verify_cap().to_string())
+        self.failUnlessEqual(u2vs[len("URI:DIR2-"):], u2vfs[len("URI:"):])
         self.failUnless(str(u2_verifier))
 
     def test_literal(self):
index 83d80f5d0b34612161e0f4701cdd38aca48dfc0f..7c0bc10f5c026d79691f8babe55555a16d3999ed 100644 (file)
@@ -115,6 +115,7 @@ class CHKFileURI(_BaseURI):
 class CHKFileVerifierURI(_BaseURI):
     implements(IVerifierURI)
 
+    BASE_STRING='URI:CHK-Verifier:'
     STRING_RE=re.compile('^URI:CHK-Verifier:'+BASE32STR_128bits+':'+
                          BASE32STR_256bits+':'+NUMBER+':'+NUMBER+':'+NUMBER)
     HUMAN_RE=re.compile('^'+OPTIONALHTTPLEAD+'URI'+SEP+'CHK-Verifier'+SEP+