From 05d271c7c89a03e78c32d5bf94da8cbcdace1ac9 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Mon, 7 Dec 2020 09:26:58 -0500 Subject: [PATCH] a little more exposition --- src/allmydata/test/cli/test_alias.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/allmydata/test/cli/test_alias.py b/src/allmydata/test/cli/test_alias.py index 335239d5f..67f438fa5 100644 --- a/src/allmydata/test/cli/test_alias.py +++ b/src/allmydata/test/cli/test_alias.py @@ -32,6 +32,12 @@ class ListAlias(GridTestMixin, CLITestMixin, unittest.TestCase): self.basedir = self.mktemp() self.set_up_grid(oneshare=True) + # We can pass an encoding into the test utilities to invoke the code + # under test but we can't pass such a parameter directly to the code + # under test. Instead, that code looks at io_encoding. So, + # monkey-patch that value to our desired value here. This is the code + # that most directly takes the place of messing with LANG or the + # locale module. self.patch(encodingutil, "io_encoding", encoding) rc, stdout, stderr = yield self.do_cli_unicode( @@ -40,15 +46,20 @@ class ListAlias(GridTestMixin, CLITestMixin, unittest.TestCase): encoding=encoding, ) - self.assertEqual( - u"Alias '{}' created\n".format(alias), - stdout, - ) + # Make sure the result of the create-alias command is as we want it to + # be. + self.assertEqual(u"Alias '{}' created\n".format(alias), stdout) self.assertEqual("", stderr) + self.assertEqual(0, rc) + + # Make sure it had the intended side-effect, too - an alias created in + # the node filesystem state. aliases = get_aliases(self.get_clientdir()) self.assertIn(alias, aliases) self.assertTrue(aliases[alias].startswith(u"URI:DIR2:")) + # And inspect the state via the user interface list-aliases command + # too. rc, stdout, stderr = yield self.do_cli_unicode( u"list-aliases", [u"--json"],