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:
Clint Byrum
2014-01-16 12:04:17 -08:00
parent 5cf407a38b
commit e447666860

View 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