summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClint Byrum <clint@fewbar.com>2014-01-16 12:04:17 -0800
committerClint Byrum <clint@fewbar.com>2014-02-03 13:45:38 -0800
commite447666860730039eb1a3fa040f79d6b8a852fd5 (patch)
treeffc4243d238c1de5777dc018c664380060917529
parent5cf407a38bf3912dd405e522d6d16550f70987e9 (diff)
downloadcliff-e447666860730039eb1a3fa040f79d6b8a852fd5.tar.gz
Add unit test for shell formatter
This is in prepration for changing the behavior to escape double quotes. Change-Id: Ib82511d066d70a1603b80ba8680b005e00113483 Related-Bug: #1269908
-rw-r--r--cliff/tests/test_formatters_shell.py20
1 files changed, 20 insertions, 0 deletions
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