dirnode: cleanup, make get_verifier() always return a URI instance, not a string
This commit is contained in:
parent
28a9f8f076
commit
f6eeb3161f
|
@ -242,7 +242,7 @@ class NewDirectoryNode:
|
||||||
return self._uri.get_readonly().to_string()
|
return self._uri.get_readonly().to_string()
|
||||||
|
|
||||||
def get_verifier(self):
|
def get_verifier(self):
|
||||||
return self._uri.get_verifier().to_string()
|
return self._uri.get_verifier()
|
||||||
|
|
||||||
def get_storage_index(self):
|
def get_storage_index(self):
|
||||||
return self._uri._filenode_uri.storage_index
|
return self._uri._filenode_uri.storage_index
|
||||||
|
|
|
@ -25,8 +25,7 @@ class Marker:
|
||||||
self.nodeuri = nodeuri
|
self.nodeuri = nodeuri
|
||||||
si = hashutil.tagged_hash("tag1", nodeuri)[:16]
|
si = hashutil.tagged_hash("tag1", nodeuri)[:16]
|
||||||
fp = hashutil.tagged_hash("tag2", nodeuri)
|
fp = hashutil.tagged_hash("tag2", nodeuri)
|
||||||
self.verifieruri = uri.SSKVerifierURI(storage_index=si,
|
self.verifieruri = uri.SSKVerifierURI(storage_index=si, fingerprint=fp)
|
||||||
fingerprint=fp).to_string()
|
|
||||||
def get_uri(self):
|
def get_uri(self):
|
||||||
return self.nodeuri
|
return self.nodeuri
|
||||||
def get_readonly_uri(self):
|
def get_readonly_uri(self):
|
||||||
|
@ -279,7 +278,7 @@ class Dirnode(unittest.TestCase, testutil.ShouldFailMixin, testutil.StallMixin):
|
||||||
self.failUnless(u.startswith("URI:DIR2:"), u)
|
self.failUnless(u.startswith("URI:DIR2:"), u)
|
||||||
u_ro = n.get_readonly_uri()
|
u_ro = n.get_readonly_uri()
|
||||||
self.failUnless(u_ro.startswith("URI:DIR2-RO:"), u_ro)
|
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.failUnless(u_v.startswith("URI:DIR2-Verifier:"), u_v)
|
||||||
self.expected_manifest.append(u_v)
|
self.expected_manifest.append(u_v)
|
||||||
expected_si = n._uri._filenode_uri.storage_index
|
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()
|
fake_file_uri = make_mutable_file_uri()
|
||||||
other_file_uri = make_mutable_file_uri()
|
other_file_uri = make_mutable_file_uri()
|
||||||
m = Marker(fake_file_uri)
|
m = Marker(fake_file_uri)
|
||||||
ffu_v = m.get_verifier()
|
ffu_v = m.get_verifier().to_string()
|
||||||
assert isinstance(ffu_v, str)
|
|
||||||
self.expected_manifest.append(ffu_v)
|
self.expected_manifest.append(ffu_v)
|
||||||
d.addCallback(lambda res: n.set_uri(u"child", fake_file_uri))
|
d.addCallback(lambda res: n.set_uri(u"child", fake_file_uri))
|
||||||
d.addCallback(lambda res:
|
d.addCallback(lambda res:
|
||||||
|
@ -312,7 +310,7 @@ class Dirnode(unittest.TestCase, testutil.ShouldFailMixin, testutil.StallMixin):
|
||||||
def _created(subdir):
|
def _created(subdir):
|
||||||
self.failUnless(isinstance(subdir, FakeDirectoryNode))
|
self.failUnless(isinstance(subdir, FakeDirectoryNode))
|
||||||
self.subdir = subdir
|
self.subdir = subdir
|
||||||
new_v = subdir.get_verifier()
|
new_v = subdir.get_verifier().to_string()
|
||||||
assert isinstance(new_v, str)
|
assert isinstance(new_v, str)
|
||||||
self.expected_manifest.append(new_v)
|
self.expected_manifest.append(new_v)
|
||||||
d.addCallback(_created)
|
d.addCallback(_created)
|
||||||
|
|
Loading…
Reference in New Issue