From: Brian Warner Date: Sat, 2 Aug 2008 02:29:38 +0000 (-0700) Subject: test_cli.py: factor out CLITestMixin X-Git-Url: https://git.rkrishnan.org/components/%22news.html/frontends/FTP-and-SFTP.txt?a=commitdiff_plain;h=35afe726c195c18ec056612d4688da8a496164ea;p=tahoe-lafs%2Ftahoe-lafs.git test_cli.py: factor out CLITestMixin --- diff --git a/src/allmydata/test/test_cli.py b/src/allmydata/test/test_cli.py index fb59478b..d7a62e84 100644 --- a/src/allmydata/test/test_cli.py +++ b/src/allmydata/test/test_cli.py @@ -217,8 +217,7 @@ class CLI(unittest.TestCase): self.failUnless("storage index: nt4fwemuw7flestsezvo2eveke" in output, output) self.failUnless("fingerprint: 737p57x6737p57x6737p57x6737p57x6737p57x6737p57x6737a" in output, output) -class CreateAlias(SystemTestMixin, unittest.TestCase): - +class CLITestMixin: def do_cli(self, verb, *args, **kwargs): nodeargs = [ "--node-directory", self.getdir("client0"), @@ -234,6 +233,8 @@ class CreateAlias(SystemTestMixin, unittest.TestCase): d.addCallback(_done) return d +class CreateAlias(SystemTestMixin, CLITestMixin, unittest.TestCase): + def test_create(self): self.basedir = os.path.dirname(self.mktemp()) d = self.set_up_nodes() @@ -247,22 +248,7 @@ class CreateAlias(SystemTestMixin, unittest.TestCase): d.addCallback(_done) return d -class Put(SystemTestMixin, unittest.TestCase): - - def do_cli(self, verb, *args, **kwargs): - nodeargs = [ - "--node-directory", self.getdir("client0"), - ] - argv = [verb] + nodeargs + list(args) - stdin = kwargs.get("stdin", "") - stdout, stderr = StringIO(), StringIO() - d = threads.deferToThread(runner.runner, argv, run_by_human=False, - stdin=StringIO(stdin), - stdout=stdout, stderr=stderr) - def _done(res): - return stdout.getvalue(), stderr.getvalue() - d.addCallback(_done) - return d +class Put(SystemTestMixin, CLITestMixin, unittest.TestCase): def test_unlinked_immutable_stdin(self): # tahoe get `echo DATA | tahoe put`