mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix tests and "convert" text output to "txt" when choosing outputter.
This commit is contained in:
parent
98067370ad
commit
c60e4dd645
3 changed files with 43 additions and 6 deletions
|
@ -32,6 +32,8 @@ def get_printout(out, opts=None, **kwargs):
|
|||
if 'output' in opts:
|
||||
# new --out option
|
||||
out = opts['output']
|
||||
if out == 'text':
|
||||
out = 'txt'
|
||||
else:
|
||||
# XXX: This should be removed before 0.10.8 comes out
|
||||
for outputter in STATIC:
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
import sys
|
||||
|
||||
# Import salt libs
|
||||
from salt import version
|
||||
from saltunittest import TestLoader, TextTestRunner, skipIf
|
||||
import integration
|
||||
from integration import TestDaemon
|
||||
|
@ -30,9 +31,19 @@ class CallTest(integration.ShellCase, integration.ShellCaseCommonTestsMixIn):
|
|||
|
||||
def test_text_output(self):
|
||||
out = self.run_call('--text-out test.fib 3')
|
||||
self.assertEqual(
|
||||
'local: ([0, 1, 1, 2]', ''.join(out).rsplit(",", 1)[0]
|
||||
)
|
||||
if version.__version_info__ < (0, 10, 8):
|
||||
expect = [
|
||||
"WARNING: The option --text-out is deprecated. Please "
|
||||
"consider using '--out text' instead."
|
||||
]
|
||||
else:
|
||||
expect = []
|
||||
|
||||
expect += [
|
||||
'local: ([0, 1, 1, 2]'
|
||||
]
|
||||
|
||||
self.assertEqual(''.join(expect), ''.join(out).rsplit(",", 1)[0])
|
||||
|
||||
@skipIf(sys.platform.startswith('win'), 'This test does not apply on Win')
|
||||
def test_user_delete_kw_output(self):
|
||||
|
|
|
@ -5,6 +5,7 @@ import shutil
|
|||
import tempfile
|
||||
|
||||
# Import salt libs
|
||||
from salt import version
|
||||
from saltunittest import TestLoader, TextTestRunner
|
||||
import integration
|
||||
from integration import TestDaemon
|
||||
|
@ -37,8 +38,15 @@ class KeyTest(integration.ShellCase,
|
|||
test salt-key -L --json-out
|
||||
'''
|
||||
data = self.run_key('-L --json-out')
|
||||
if version.__version_info__ < (0, 10, 8):
|
||||
expect = [
|
||||
"WARNING: The option --json-out is deprecated. Please "
|
||||
"consider using '--out json' instead."
|
||||
]
|
||||
else:
|
||||
expect = []
|
||||
|
||||
expect = [
|
||||
expect += [
|
||||
'{',
|
||||
' "minions_rejected": [], ',
|
||||
' "minions_pre": [], ',
|
||||
|
@ -55,7 +63,15 @@ class KeyTest(integration.ShellCase,
|
|||
test salt-key -L --yaml-out
|
||||
'''
|
||||
data = self.run_key('-L --yaml-out')
|
||||
expect = [
|
||||
if version.__version_info__ < (0, 10, 8):
|
||||
expect = [
|
||||
"WARNING: The option --yaml-out is deprecated. Please "
|
||||
"consider using '--out yaml' instead."
|
||||
]
|
||||
else:
|
||||
expect = []
|
||||
|
||||
expect += [
|
||||
'minions:',
|
||||
'- minion',
|
||||
'- sub_minion',
|
||||
|
@ -69,7 +85,15 @@ class KeyTest(integration.ShellCase,
|
|||
test salt-key -L --raw-out
|
||||
'''
|
||||
data = self.run_key('-L --raw-out')
|
||||
expect = [
|
||||
if version.__version_info__ < (0, 10, 8):
|
||||
expect = [
|
||||
"WARNING: The option --raw-out is deprecated. Please "
|
||||
"consider using '--out raw' instead."
|
||||
]
|
||||
else:
|
||||
expect = []
|
||||
|
||||
expect += [
|
||||
"{'minions_rejected': [], 'minions_pre': [], "
|
||||
"'minions': ['minion', 'sub_minion']}"
|
||||
]
|
||||
|
|
Loading…
Add table
Reference in a new issue