Add unit test for shell formatter
This is in prepration for changing the behavior to escape double quotes. Change-Id: Ib82511d066d70a1603b80ba8680b005e00113483 Related-Bug: #1269908
This commit is contained in:
20
cliff/tests/test_formatters_shell.py
Normal file
20
cliff/tests/test_formatters_shell.py
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env python
|
||||
from six import StringIO
|
||||
|
||||
from cliff.formatters import shell
|
||||
|
||||
import mock
|
||||
|
||||
|
||||
def test_shell_formatter():
|
||||
sf = shell.ShellFormatter()
|
||||
c = ('a', 'b', 'c')
|
||||
d = ('A', 'B', 'C')
|
||||
expected = 'a="A"\nb="B"\n'
|
||||
output = StringIO()
|
||||
args = mock.Mock()
|
||||
args.variables = ['a', 'b']
|
||||
args.prefix = ''
|
||||
sf.emit_one(c, d, output, args)
|
||||
actual = output.getvalue()
|
||||
assert expected == actual
|
||||
Reference in New Issue
Block a user