mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-19 13:07:56 +00:00
test_runner: cleanup, refactor common code into a non-executable method
Having both test_node() and test_client() (one of which calls the other) felt confusing to me, so I changed it to have test_node(), test_client(), and a common do_create() helper method.
This commit is contained in:
parent
5045a8721a
commit
3880486f91
@ -64,8 +64,7 @@ class CreateNode(unittest.TestCase):
|
|||||||
rc = runner.runner(argv, stdout=out, stderr=err)
|
rc = runner.runner(argv, stdout=out, stderr=err)
|
||||||
return rc, out.getvalue(), err.getvalue()
|
return rc, out.getvalue(), err.getvalue()
|
||||||
|
|
||||||
def test_node(self, command="create-node"):
|
def do_create(self, command, basedir):
|
||||||
basedir = self.workdir("test_node")
|
|
||||||
c1 = os.path.join(basedir, command + "-c1")
|
c1 = os.path.join(basedir, command + "-c1")
|
||||||
argv = ["--quiet", command, "--basedir", c1]
|
argv = ["--quiet", command, "--basedir", c1]
|
||||||
rc, out, err = self.run_tahoe(argv)
|
rc, out, err = self.run_tahoe(argv)
|
||||||
@ -74,7 +73,7 @@ class CreateNode(unittest.TestCase):
|
|||||||
self.failUnlessEqual(rc, 0)
|
self.failUnlessEqual(rc, 0)
|
||||||
self.failUnless(os.path.exists(c1))
|
self.failUnless(os.path.exists(c1))
|
||||||
self.failUnless(os.path.exists(os.path.join(c1, "tahoe-client.tac")))
|
self.failUnless(os.path.exists(os.path.join(c1, "tahoe-client.tac")))
|
||||||
|
|
||||||
# tahoe.cfg should exist, and should have storage enabled for
|
# tahoe.cfg should exist, and should have storage enabled for
|
||||||
# 'create-node', and disabled for 'create-client'.
|
# 'create-node', and disabled for 'create-client'.
|
||||||
tahoe_cfg = os.path.join(c1, "tahoe.cfg")
|
tahoe_cfg = os.path.join(c1, "tahoe.cfg")
|
||||||
@ -109,9 +108,14 @@ class CreateNode(unittest.TestCase):
|
|||||||
runner.runner, argv,
|
runner.runner, argv,
|
||||||
run_by_human=False)
|
run_by_human=False)
|
||||||
|
|
||||||
|
def test_node(self):
|
||||||
|
basedir = self.workdir("test_node")
|
||||||
|
self.do_create("create-node", basedir)
|
||||||
|
|
||||||
def test_client(self):
|
def test_client(self):
|
||||||
# create-client should behave like create-node --no-storage.
|
# create-client should behave like create-node --no-storage.
|
||||||
self.test_node(command="create-client")
|
basedir = self.workdir("test_client")
|
||||||
|
self.do_create("create-client", basedir)
|
||||||
|
|
||||||
def test_introducer(self):
|
def test_introducer(self):
|
||||||
basedir = self.workdir("test_introducer")
|
basedir = self.workdir("test_introducer")
|
||||||
|
Loading…
Reference in New Issue
Block a user