def _test_webopen(self, args, expected_url): o = runner.Options() o.parseOptions(["--node-directory", self.get_clientdir(), "webopen"] + list(args)) urls = [] rc = cli.webopen(o, urls.append) self.failUnlessReallyEqual(rc, 0) self.failUnlessReallyEqual(len(urls), 1) self.failUnlessReallyEqual(urls[0], expected_url)
def test_daemonize_options(self): parent = runner.Options() opts = DaemonizeOptions() opts.parent = parent opts.parseArgs() # just gratuitous coverage, ensureing we don't blow up on # these methods. opts.getSynopsis() opts.getUsage()
def _test_webopen(self, args, expected_url): o = runner.Options() o.parseOptions(["--node-directory", self.get_clientdir(), "webopen"] + list(args)) urls = [] o.subOptions.stdout = StringIO() o.subOptions.stderr = StringIO() o.subOptions.stdin = StringIO() rc = cli.webopen(o.subOptions, urls.append) self.failUnlessReallyEqual(rc, 0) self.failUnlessReallyEqual(len(urls), 1) self.assertEqual(urls[0], expected_url)
def parse_options(basedir, command, args): o = runner.Options() o.parseOptions(["--node-directory", basedir, command] + args) while hasattr(o, "subOptions"): o = o.subOptions return o