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
1=== modified file 'linaro_image_tools/hwpack/tests/test_config_v3.py'
2--- linaro_image_tools/hwpack/tests/test_config_v3.py 2012-12-07 08:47:58 +0000
3+++ linaro_image_tools/hwpack/tests/test_config_v3.py 2012-12-27 10:31:23 +0000
4@@ -347,6 +347,13 @@
5 self.assertValidationError("Invalid serial tty: ttxSAC1",
6 config._validate_serial_tty)
7
8+ def test_validate_mmc_id_wrong(self):
9+ # The mmc_id value, if coming from a yaml file, has to be quoted.
10+ # Make sure the test does not accept a valid-unquoted value.
11+ config = self.get_config(self.valid_complete_v3 +
12+ "mmc_id: 1:1\n")
13+ self.assertRaises(HwpackConfigError, config._validate_mmc_id)
14+
15 def test_validate_mmc_id(self):
16 config = self.get_config(self.valid_complete_v3 +
17 "mmc_id: x\n")
18
19=== modified file 'linaro_image_tools/hwpack/tests/test_hwpack_converter.py'
20--- linaro_image_tools/hwpack/tests/test_hwpack_converter.py 2012-10-17 14:53:24 +0000
21+++ linaro_image_tools/hwpack/tests/test_hwpack_converter.py 2012-12-27 10:31:23 +0000
22@@ -166,3 +166,18 @@
23 converter = HwpackConverter(input_file, output_file)
24 converter._parse()
25 self.assertEqual(out_format, str(converter))
26+
27+ def test_mmc_id(self):
28+ """Test correct handling of mmc_id field.
29+
30+ The mmc_id field has to be quoted coming out from the converter
31+ otherwise when reading the yaml file the value is read as a number,
32+ not a string."""
33+ ini_format = ("[hwpack]\nformat=2.0\nmmc_id=1:1")
34+ out_format = ("format: '3.0'\nmmc_id: '1:1'\n")
35+ input_file = self.useFixture(CreateTempFileFixture(ini_format)).\
36+ get_file_name()
37+ output_file = self.useFixture(CreateTempFileFixture()).get_file_name()
38+ converter = HwpackConverter(input_file, output_file)
39+ converter._parse()
40+ self.assertEqual(out_format, str(converter))

Subscribers

People subscribed via source and target branches