From e447666860730039eb1a3fa040f79d6b8a852fd5 Mon Sep 17 00:00:00 2001 From: Clint Byrum Date: Thu, 16 Jan 2014 12:04:17 -0800 Subject: Add unit test for shell formatter This is in prepration for changing the behavior to escape double quotes. Change-Id: Ib82511d066d70a1603b80ba8680b005e00113483 Related-Bug: #1269908 --- cliff/tests/test_formatters_shell.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 cliff/tests/test_formatters_shell.py diff --git a/cliff/tests/test_formatters_shell.py b/cliff/tests/test_formatters_shell.py new file mode 100644 index 0000000..5d49e65 --- /dev/null +++ b/cliff/tests/test_formatters_shell.py @@ -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 -- cgit v1.2.1