Merge lp:~milo/linaro-image-tools/bug1085412 into lp:linaro-image-tools/11.11

Proposed by Milo Casagrande
Status: Merged
Approved by: Fathi Boudra
Approved revision: 595
Merged at revision: 594
Proposed branch: lp:~milo/linaro-image-tools/bug1085412
Merge into: lp:linaro-image-tools/11.11
Diff against target: 40 lines (+22/-0)
2 files modified
linaro_image_tools/hwpack/tests/test_config_v3.py (+7/-0)
linaro_image_tools/hwpack/tests/test_hwpack_converter.py (+15/-0)
To merge this branch: bzr merge lp:~milo/linaro-image-tools/bug1085412
Reviewer Review Type Date Requested Status
Fathi Boudra Approve
Review via email: mp+141324@code.launchpad.net

Description of the change

Add two new tests to make sure we are handling the mmc_id field correctly:
- make sure that passing an un-quoted value raises the exception
- and assure that the converter between hwpack format 2 to 3 quotes correctly

To post a comment you must log in.
595. By Milo Casagrande

Added comments.

Revision history for this message
Fathi Boudra (fboudra) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'linaro_image_tools/hwpack/tests/test_config_v3.py'
--- linaro_image_tools/hwpack/tests/test_config_v3.py 2012-12-07 08:47:58 +0000
+++ linaro_image_tools/hwpack/tests/test_config_v3.py 2012-12-27 10:31:23 +0000
@@ -347,6 +347,13 @@
347 self.assertValidationError("Invalid serial tty: ttxSAC1",347 self.assertValidationError("Invalid serial tty: ttxSAC1",
348 config._validate_serial_tty)348 config._validate_serial_tty)
349349
350 def test_validate_mmc_id_wrong(self):
351 # The mmc_id value, if coming from a yaml file, has to be quoted.
352 # Make sure the test does not accept a valid-unquoted value.
353 config = self.get_config(self.valid_complete_v3 +
354 "mmc_id: 1:1\n")
355 self.assertRaises(HwpackConfigError, config._validate_mmc_id)
356
350 def test_validate_mmc_id(self):357 def test_validate_mmc_id(self):
351 config = self.get_config(self.valid_complete_v3 +358 config = self.get_config(self.valid_complete_v3 +
352 "mmc_id: x\n")359 "mmc_id: x\n")
353360
=== modified file 'linaro_image_tools/hwpack/tests/test_hwpack_converter.py'
--- linaro_image_tools/hwpack/tests/test_hwpack_converter.py 2012-10-17 14:53:24 +0000
+++ linaro_image_tools/hwpack/tests/test_hwpack_converter.py 2012-12-27 10:31:23 +0000
@@ -166,3 +166,18 @@
166 converter = HwpackConverter(input_file, output_file)166 converter = HwpackConverter(input_file, output_file)
167 converter._parse()167 converter._parse()
168 self.assertEqual(out_format, str(converter))168 self.assertEqual(out_format, str(converter))
169
170 def test_mmc_id(self):
171 """Test correct handling of mmc_id field.
172
173 The mmc_id field has to be quoted coming out from the converter
174 otherwise when reading the yaml file the value is read as a number,
175 not a string."""
176 ini_format = ("[hwpack]\nformat=2.0\nmmc_id=1:1")
177 out_format = ("format: '3.0'\nmmc_id: '1:1'\n")
178 input_file = self.useFixture(CreateTempFileFixture(ini_format)).\
179 get_file_name()
180 output_file = self.useFixture(CreateTempFileFixture()).get_file_name()
181 converter = HwpackConverter(input_file, output_file)
182 converter._parse()
183 self.assertEqual(out_format, str(converter))

Subscribers

People subscribed via source and target branches