From 526ed994b870071eaa2b515ed5b9b3130a05ad4a Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Sat, 17 Nov 2012 17:39:06 +0000 Subject: [PATCH] Test for deprecation message first and then use the new `--out` format. --- tests/integration/shell/key.py | 39 ++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/tests/integration/shell/key.py b/tests/integration/shell/key.py index 2ff8ea4eb9..a95a72d6cb 100644 --- a/tests/integration/shell/key.py +++ b/tests/integration/shell/key.py @@ -39,14 +39,15 @@ class KeyTest(integration.ShellCase, ''' data = self.run_key('-L --json-out') if version.__version_info__ < (0, 10, 8): - expect = [ + self.assertEqual( "WARNING: The option --json-out is deprecated. Please " - "consider using '--out json' instead." - ] - else: - expect = [] + "consider using '--out json' instead.", + data[0] + ) - expect += [ + data = self.run_key('-L --out json') + + expect = [ '{', ' "minions_rejected": [], ', ' "minions_pre": [], ', @@ -64,14 +65,15 @@ class KeyTest(integration.ShellCase, ''' data = self.run_key('-L --yaml-out') if version.__version_info__ < (0, 10, 8): - expect = [ + self.assertEqual( "WARNING: The option --yaml-out is deprecated. Please " - "consider using '--out yaml' instead." - ] - else: - expect = [] + "consider using '--out yaml' instead.", + data[0] + ) - expect += [ + data = self.run_key('-L --out yaml') + + expect = [ 'minions:', '- minion', '- sub_minion', @@ -86,14 +88,15 @@ class KeyTest(integration.ShellCase, ''' data = self.run_key('-L --raw-out') if version.__version_info__ < (0, 10, 8): - expect = [ + self.assertEqual( "WARNING: The option --raw-out is deprecated. Please " - "consider using '--out raw' instead." - ] - else: - expect = [] + "consider using '--out raw' instead.", + data[0] + ) - expect += [ + data = self.run_key('-L --out raw') + + expect = [ "{'minions_rejected': [], 'minions_pre': [], " "'minions': ['minion', 'sub_minion']}" ]