diff options
author | Milo Casagrande <milo@ubuntu.com> | 2012-12-27 13:51:49 +0100 |
---|---|---|
committer | Milo Casagrande <milo@ubuntu.com> | 2012-12-27 13:51:49 +0100 |
commit | 3a298a0d6d3f6830b5fa9aedb9ffa90f4a802ac7 (patch) | |
tree | 704d1947f465c06883a08fd2737f7d8ec876054a | |
parent | d84febb22350bf6263c1b61ee7d9a17043540d75 (diff) | |
parent | 06708766ddc363579a55e49ae0d97a3ef8e4ef4c (diff) |
Merged hwpack-args into fix-tests.
-rw-r--r-- | linaro_image_tools/hwpack/tests/test_config_v3.py | 7 | ||||
-rw-r--r-- | linaro_image_tools/hwpack/tests/test_hwpack_converter.py | 15 |
2 files changed, 22 insertions, 0 deletions
diff --git a/linaro_image_tools/hwpack/tests/test_config_v3.py b/linaro_image_tools/hwpack/tests/test_config_v3.py index cc63a76..27eb952 100644 --- a/linaro_image_tools/hwpack/tests/test_config_v3.py +++ b/linaro_image_tools/hwpack/tests/test_config_v3.py @@ -347,6 +347,13 @@ class ConfigTests(TestCase): self.assertValidationError("Invalid serial tty: ttxSAC1", config._validate_serial_tty) + def test_validate_mmc_id_wrong(self): + # The mmc_id value, if coming from a yaml file, has to be quoted. + # Make sure the test does not accept a valid-unquoted value. + config = self.get_config(self.valid_complete_v3 + + "mmc_id: 1:1\n") + self.assertRaises(HwpackConfigError, config._validate_mmc_id) + def test_validate_mmc_id(self): config = self.get_config(self.valid_complete_v3 + "mmc_id: x\n") diff --git a/linaro_image_tools/hwpack/tests/test_hwpack_converter.py b/linaro_image_tools/hwpack/tests/test_hwpack_converter.py index 3e830da..4f83994 100644 --- a/linaro_image_tools/hwpack/tests/test_hwpack_converter.py +++ b/linaro_image_tools/hwpack/tests/test_hwpack_converter.py @@ -166,3 +166,18 @@ class HwpackConverterTests(TestCaseWithFixtures): converter = HwpackConverter(input_file, output_file) converter._parse() self.assertEqual(out_format, str(converter)) + + def test_mmc_id(self): + """Test correct handling of mmc_id field. + + The mmc_id field has to be quoted coming out from the converter + otherwise when reading the yaml file the value is read as a number, + not a string.""" + ini_format = ("[hwpack]\nformat=2.0\nmmc_id=1:1") + out_format = ("format: '3.0'\nmmc_id: '1:1'\n") + input_file = self.useFixture(CreateTempFileFixture(ini_format)).\ + get_file_name() + output_file = self.useFixture(CreateTempFileFixture()).get_file_name() + converter = HwpackConverter(input_file, output_file) + converter._parse() + self.assertEqual(out_format, str(converter)) |