summaryrefslogtreecommitdiff
path: root/cliff/tests/test_formatters_shell.py
blob: 5d49e650f396437e481a41fc2540a54804e7ac4c (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 = ('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