blob: 93452ba38ee9e79c86118b65124037b2754d6151 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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')
d = ('A', 'B', 'C', '"escape me"')
expected = 'a="A"\nb="B"\nd="\\"escape me\\""\n'
output = StringIO()
args = mock.Mock()
args.variables = ['a', 'b', 'd']
args.prefix = ''
sf.emit_one(c, d, output, args)
actual = output.getvalue()
assert expected == actual
|