diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2014-04-04 18:54:58 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2014-04-04 19:32:28 +0100 |
commit | af9e7041f766f42385870d55498da6032059f601 (patch) | |
tree | 58edf9cf4e57fefc75788763a8e0b590e5865b2e /tests | |
parent | e876737a6938a1ee6a6322b8d4f619ef87a7ccde (diff) | |
download | sos-af9e7041f766f42385870d55498da6032059f601.tar.gz |
Clean up sos_get_command_output() and friends
Returning a 3-tuple has always been ugly. It gets worse as the
parameter list for this family of functions grows. Worse, the 3rd
member of the tuple is unused and is always set to 0.
Rip the whole mess out and return a single, simple dictionary
object with 'status' and 'output' keys.
Update utilities_tests to reflect the new interface.
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/utilities_tests.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/utilities_tests.py b/tests/utilities_tests.py index 22b2bbea..60087c18 100644 --- a/tests/utilities_tests.py +++ b/tests/utilities_tests.py @@ -58,15 +58,15 @@ class ExecutableTest(unittest.TestCase): def test_output(self): path = os.path.join(TEST_DIR, 'test_exe.py') - ret, out, junk = sos_get_command_output(path) - self.assertEquals(ret, 0) - self.assertEquals(out, "executed\n") + result = sos_get_command_output(path) + self.assertEquals(result['status'], 0) + self.assertEquals(result['output'], "executed\n") def test_output_non_exe(self): path = os.path.join(TEST_DIR, 'utility_tests.py') - ret, out, junk = sos_get_command_output(path) - self.assertEquals(ret, 127) - self.assertEquals(out, "") + result = sos_get_command_output(path) + self.assertEquals(result['status'], 127) + self.assertEquals(result['output'], "") def test_shell_out(self): path = os.path.join(TEST_DIR, 'test_exe.py') |