more runner.py test coverage: don't bypass argv parsing
This commit is contained in:
parent
912fc5a77e
commit
78c2376fa3
|
@ -376,9 +376,12 @@ class SystemTest(testutil.SignalMixin, unittest.TestCase):
|
||||||
log.msg("test_system.SystemTest._test_runner using %s" % dirpath)
|
log.msg("test_system.SystemTest._test_runner using %s" % dirpath)
|
||||||
|
|
||||||
filename = os.path.join(dirpath, "uri_extension")
|
filename = os.path.join(dirpath, "uri_extension")
|
||||||
s = StringIO()
|
|
||||||
rc = runner.dump_uri_extension({'filename': filename}, s)
|
out,err = StringIO(), StringIO()
|
||||||
output = s.getvalue()
|
rc = runner.runner(["dump-uri-extension",
|
||||||
|
filename],
|
||||||
|
stdout=out, stderr=err)
|
||||||
|
output = out.getvalue()
|
||||||
self.failUnlessEqual(rc, 0)
|
self.failUnlessEqual(rc, 0)
|
||||||
|
|
||||||
# we only upload a single file, so we can assert some things about
|
# we only upload a single file, so we can assert some things about
|
||||||
|
|
|
@ -244,19 +244,22 @@ class Test(unittest.TestCase):
|
||||||
|
|
||||||
def _test_one_3(self, res):
|
def _test_one_3(self, res):
|
||||||
# now test some of the diag tools with the data we've created
|
# now test some of the diag tools with the data we've created
|
||||||
s = StringIO()
|
out,err = StringIO(), StringIO()
|
||||||
rc = runner.dump_root_dirnode("vdrive/test_one", {}, s)
|
rc = runner.runner(["dump-root-dirnode", "vdrive/test_one"],
|
||||||
output = s.getvalue()
|
stdout=out, stderr=err)
|
||||||
|
output = out.getvalue()
|
||||||
self.failUnless(output.startswith("URI:DIR:fakeFURL:"))
|
self.failUnless(output.startswith("URI:DIR:fakeFURL:"))
|
||||||
self.failUnlessEqual(rc, 0)
|
self.failUnlessEqual(rc, 0)
|
||||||
|
|
||||||
s = StringIO()
|
out,err = StringIO(), StringIO()
|
||||||
args = {'uri': self.bar_node.get_uri(),
|
rc = runner.runner(["dump-dirnode",
|
||||||
'verbose': True,
|
"--basedir", "vdrive/test_one",
|
||||||
}
|
"--verbose",
|
||||||
rc = runner.dump_directory_node("vdrive/test_one", args, s)
|
self.bar_node.get_uri()],
|
||||||
output = s.getvalue()
|
stdout=out, stderr=err)
|
||||||
|
output = out.getvalue()
|
||||||
#print output
|
#print output
|
||||||
|
self.failUnlessEqual(rc, 0)
|
||||||
self.failUnless("dirnode uri: URI:DIR:myFURL" in output)
|
self.failUnless("dirnode uri: URI:DIR:myFURL" in output)
|
||||||
self.failUnless("write_enabler" in output)
|
self.failUnless("write_enabler" in output)
|
||||||
self.failIf("write_enabler: None" in output)
|
self.failIf("write_enabler: None" in output)
|
||||||
|
@ -265,15 +268,16 @@ class Test(unittest.TestCase):
|
||||||
self.failUnless(" read: URI:DIR-RO:myFURL:" in output)
|
self.failUnless(" read: URI:DIR-RO:myFURL:" in output)
|
||||||
self.failUnless("key file4\n" in output)
|
self.failUnless("key file4\n" in output)
|
||||||
self.failUnless("H_key " in output)
|
self.failUnless("H_key " in output)
|
||||||
self.failUnlessEqual(rc, 0)
|
|
||||||
|
|
||||||
s = StringIO()
|
out,err = StringIO(), StringIO()
|
||||||
args = {'uri': self.bar_node.get_uri(),
|
rc = runner.runner(["dump-dirnode",
|
||||||
'verbose': False,
|
"--basedir", "vdrive/test_one",
|
||||||
}
|
# non-verbose
|
||||||
rc = runner.dump_directory_node("vdrive/test_one", args, s)
|
"--uri", self.bar_node.get_uri()],
|
||||||
output = s.getvalue()
|
stdout=out, stderr=err)
|
||||||
|
output = out.getvalue()
|
||||||
#print output
|
#print output
|
||||||
|
self.failUnlessEqual(rc, 0)
|
||||||
self.failUnless("dirnode uri: URI:DIR:myFURL" in output)
|
self.failUnless("dirnode uri: URI:DIR:myFURL" in output)
|
||||||
self.failUnless("write_enabler" in output)
|
self.failUnless("write_enabler" in output)
|
||||||
self.failIf("write_enabler: None" in output)
|
self.failIf("write_enabler: None" in output)
|
||||||
|
@ -282,22 +286,22 @@ class Test(unittest.TestCase):
|
||||||
self.failUnless(" read: URI:DIR-RO:myFURL:" in output)
|
self.failUnless(" read: URI:DIR-RO:myFURL:" in output)
|
||||||
self.failUnless("key file4\n" in output)
|
self.failUnless("key file4\n" in output)
|
||||||
self.failIf("H_key " in output)
|
self.failIf("H_key " in output)
|
||||||
self.failUnlessEqual(rc, 0)
|
|
||||||
|
|
||||||
s = StringIO()
|
out,err = StringIO(), StringIO()
|
||||||
args = {'uri': self.bar_node_readonly.get_uri(),
|
rc = runner.runner(["dump-dirnode",
|
||||||
'verbose': True,
|
"--basedir", "vdrive/test_one",
|
||||||
}
|
"--verbose",
|
||||||
rc = runner.dump_directory_node("vdrive/test_one", args, s)
|
self.bar_node_readonly.get_uri()],
|
||||||
output = s.getvalue()
|
stdout=out, stderr=err)
|
||||||
|
output = out.getvalue()
|
||||||
#print output
|
#print output
|
||||||
|
self.failUnlessEqual(rc, 0)
|
||||||
self.failUnless("dirnode uri: URI:DIR-RO:myFURL" in output)
|
self.failUnless("dirnode uri: URI:DIR-RO:myFURL" in output)
|
||||||
self.failUnless("write_enabler: None" in output)
|
self.failUnless("write_enabler: None" in output)
|
||||||
self.failUnless("key baz\n" in output)
|
self.failUnless("key baz\n" in output)
|
||||||
self.failIf(" write: URI:DIR:myFURL:" in output)
|
self.failIf(" write: URI:DIR:myFURL:" in output)
|
||||||
self.failUnless(" read: URI:DIR-RO:myFURL:" in output)
|
self.failUnless(" read: URI:DIR-RO:myFURL:" in output)
|
||||||
self.failUnless("key file4\n" in output)
|
self.failUnless("key file4\n" in output)
|
||||||
self.failUnlessEqual(rc, 0)
|
|
||||||
|
|
||||||
def shouldFail(self, res, expected_failure, which, substring=None):
|
def shouldFail(self, res, expected_failure, which, substring=None):
|
||||||
if isinstance(res, failure.Failure):
|
if isinstance(res, failure.Failure):
|
||||||
|
|
Loading…
Reference in New Issue