Commit 821dbb5f authored by Hrvoje Ribicic's avatar Hrvoje Ribicic
Browse files

Extend tests in preparation for new compression types

To ensure that later modifications are also noted in tests, this patch
updates the test to account for all compression types known.
Signed-off-by: default avatarHrvoje Ribicic <>
Reviewed-by: default avatarThomas Thrainer <>
parent be7ea029
......@@ -63,13 +63,22 @@ def CheckCmdWord(cmd, word):
class TestCommandBuilder(unittest.TestCase):
def test(self):
# The commands various compressions should use
compress_import = {
constants.IEC_GZIP: "gunzip",
compress_export = {
constants.IEC_GZIP: "gzip",
for mode in [constants.IEM_IMPORT, constants.IEM_EXPORT]:
if mode == constants.IEM_IMPORT:
comprcmd = "gunzip"
compress_dict = compress_import
elif mode == constants.IEM_EXPORT:
comprcmd = "gzip"
compress_dict = compress_export
for compress in [constants.IEC_NONE, constants.IEC_GZIP]:
for compress in constants.IEC_ALL:
for magic in [None, 10 * "-", "HelloWorld", "J9plh4nFo2",
opts = CmdBuilderConfig(magic=magic, compress=compress)
......@@ -100,8 +109,8 @@ class TestCommandBuilder(unittest.TestCase):
cmd = builder.GetCommand()
self.assert_(isinstance(cmd, list))
if compress == constants.IEC_GZIP:
self.assert_(CheckCmdWord(cmd, comprcmd))
if compress != constants.IEC_NONE:
self.assert_(CheckCmdWord(cmd, compress_dict[compress]))
if cmd_prefix is not None:
self.assert_(compat.any(cmd_prefix in i for i in cmd))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment