def _test_one_3(self, res):
# now test some of the diag tools with the data we've created
- s = StringIO()
- rc = runner.dump_root_dirnode("vdrive/test_one", {}, s)
- output = s.getvalue()
+ out,err = StringIO(), StringIO()
+ rc = runner.runner(["dump-root-dirnode", "vdrive/test_one"],
+ stdout=out, stderr=err)
+ output = out.getvalue()
self.failUnless(output.startswith("URI:DIR:fakeFURL:"))
self.failUnlessEqual(rc, 0)
- s = StringIO()
- args = {'uri': self.bar_node.get_uri(),
- 'verbose': True,
- }
- rc = runner.dump_directory_node("vdrive/test_one", args, s)
- output = s.getvalue()
+ out,err = StringIO(), StringIO()
+ rc = runner.runner(["dump-dirnode",
+ "--basedir", "vdrive/test_one",
+ "--verbose",
+ self.bar_node.get_uri()],
+ stdout=out, stderr=err)
+ output = out.getvalue()
#print output
+ self.failUnlessEqual(rc, 0)
self.failUnless("dirnode uri: URI:DIR:myFURL" in output)
self.failUnless("write_enabler" in output)
self.failIf("write_enabler: None" in output)
self.failUnless(" read: URI:DIR-RO:myFURL:" in output)
self.failUnless("key file4\n" in output)
self.failUnless("H_key " in output)
- self.failUnlessEqual(rc, 0)
- s = StringIO()
- args = {'uri': self.bar_node.get_uri(),
- 'verbose': False,
- }
- rc = runner.dump_directory_node("vdrive/test_one", args, s)
- output = s.getvalue()
+ out,err = StringIO(), StringIO()
+ rc = runner.runner(["dump-dirnode",
+ "--basedir", "vdrive/test_one",
+ # non-verbose
+ "--uri", self.bar_node.get_uri()],
+ stdout=out, stderr=err)
+ output = out.getvalue()
#print output
+ self.failUnlessEqual(rc, 0)
self.failUnless("dirnode uri: URI:DIR:myFURL" in output)
self.failUnless("write_enabler" in output)
self.failIf("write_enabler: None" in output)
self.failUnless(" read: URI:DIR-RO:myFURL:" in output)
self.failUnless("key file4\n" in output)
self.failIf("H_key " in output)
- self.failUnlessEqual(rc, 0)
- s = StringIO()
- args = {'uri': self.bar_node_readonly.get_uri(),
- 'verbose': True,
- }
- rc = runner.dump_directory_node("vdrive/test_one", args, s)
- output = s.getvalue()
+ out,err = StringIO(), StringIO()
+ rc = runner.runner(["dump-dirnode",
+ "--basedir", "vdrive/test_one",
+ "--verbose",
+ self.bar_node_readonly.get_uri()],
+ stdout=out, stderr=err)
+ output = out.getvalue()
#print output
+ self.failUnlessEqual(rc, 0)
self.failUnless("dirnode uri: URI:DIR-RO:myFURL" in output)
self.failUnless("write_enabler: None" in output)
self.failUnless("key baz\n" in output)
self.failIf(" write: URI:DIR:myFURL:" in output)
self.failUnless(" read: URI:DIR-RO:myFURL:" in output)
self.failUnless("key file4\n" in output)
- self.failUnlessEqual(rc, 0)
def shouldFail(self, res, expected_failure, which, substring=None):
if isinstance(res, failure.Failure):