summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJan Pokorný <jpokorny@redhat.com>2015-02-19 22:01:11 +0100
committerJan Pokorný <jpokorny@redhat.com>2015-02-26 22:37:56 +0100
commit3168633077dc297878ef72b7e4feaa0c365cb73c (patch)
treee9fd266de6d99266f2f51cd32722e41cd014c907 /tests
parent8ecf1bd8746ce6341f3856fad96a504fca6af869 (diff)
downloadclufter-3168633077dc297878ef72b7e4feaa0c365cb73c.tar.gz
clufter-3168633077dc297878ef72b7e4feaa0c365cb73c.tar.xz
clufter-3168633077dc297878ef72b7e4feaa0c365cb73c.zip
lib-general/formats/command: special "magic_split" flavor
... that allows specifying multi-argument option as a single-argument one with '::' being a logical separator between such args. This is needed, for instance, when multi-argument option is specified last to differentiate between such option argument and proper command argument (only a single argument for an option is normally expected). Also add a respective unit test. Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/formats/command.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/formats/command.py b/tests/formats/command.py
index 46982a8..1223556 100644
--- a/tests/formats/command.py
+++ b/tests/formats/command.py
@@ -7,6 +7,10 @@ __author__ = "Jan Pokorný <jpokorny @at@ Red Hat .dot. com>"
from os.path import join, dirname as d; execfile(join(d(d((__file__))), '_go'))
+try:
+ from collections import OrderedDict
+except ImportError:
+ from ordereddict import OrderedDict
from unittest import TestCase
from .format_manager import FormatManager
@@ -58,4 +62,15 @@ class FormatsCommandTestCase(TestCase):
['cut', '-f', '1', '-d', '@', 'emails.txt'])
+ def testMagicBytestringToDict(self):
+ c = command('bytestring',
+ 'gpg -k 60BCBB4F5CD7F9EF::~/.gnupg/pubring.gpg',
+ magic_split=True)
+ #print c('merged')
+ self.assertEqual(c.DICT(),
+ OrderedDict([('__cmd__', ['gpg']),
+ ('-k', [('60BCBB4F5CD7F9EF',
+ '~/.gnupg/pubring.gpg')])]))
+
+
from os.path import join, dirname as d; execfile(join(d(d(__file__)), '_gone'))