From patchwork Thu Dec 27 10:43:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fathi Boudra X-Patchwork-Id: 13719 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 0110D23EAB for ; Thu, 27 Dec 2012 10:43:16 +0000 (UTC) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by fiordland.canonical.com (Postfix) with ESMTP id 80E27A1880A for ; Thu, 27 Dec 2012 10:43:16 +0000 (UTC) Received: by mail-vc0-f172.google.com with SMTP id fw7so9877975vcb.3 for ; Thu, 27 Dec 2012 02:43:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:content-type:mime-version:x-launchpad-project :x-launchpad-branch:x-launchpad-message-rationale :x-launchpad-branch-revision-number:x-launchpad-notification-type:to :from:subject:message-id:date:reply-to:sender:errors-to:precedence :x-generated-by:x-launchpad-hash:x-gm-message-state; bh=sg3g9bonCvOJOHodMHCpM5WhWakEZr8TBbjccIY5xyQ=; b=cQx9m0marCnSn8g/P3d6GYFXnMfmUU3n06j8qdelO6/i8U4qA9z9qf7Q3f+3jU4LtK xgqJg2WkWcVeQJO+3gbV+5C3Hv6mW8kk992yWlKApQrAkF7lu25IEnrZ91Mqu630g40I gtavP+PR/8mrNwcvi2h4vgSV80V0hhWuwjHgIPGMFH2O4No5u08MnNFW5EgJIyG5ygl/ H7sAR8CWVx7QcZd6pdiDDgZt+7aNmdGmru8GV0X/KAhgw+Tn4lYRn2tHnG6+Gcw+NhZ4 gXa4G9gjr4hn4ubXvjVc9m8G0rKGtK+rtlbjLNja023RKGlon/Hc6L6B4AHH5PXDSbyL eeAw== X-Received: by 10.58.210.65 with SMTP id ms1mr46354838vec.59.1356604995896; Thu, 27 Dec 2012 02:43:15 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.214.195 with SMTP id oc3csp12076vec; Thu, 27 Dec 2012 02:43:15 -0800 (PST) X-Received: by 10.194.119.5 with SMTP id kq5mr48017633wjb.48.1356604994674; Thu, 27 Dec 2012 02:43:14 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id e11si38604164wjr.22.2012.12.27.02.43.14 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 27 Dec 2012 02:43:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1ToAvh-0003Sy-T3 for ; Thu, 27 Dec 2012 10:43:13 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id CF3A8E0180 for ; Thu, 27 Dec 2012 10:43:13 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: linaro-image-tools X-Launchpad-Branch: ~linaro-image-tools/linaro-image-tools/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 594 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-image-tools/linaro-image-tools/trunk] Rev 594: Added couple of tests for mmc_id field handling. Message-Id: <20121227104313.7292.46055.launchpad@ackee.canonical.com> Date: Thu, 27 Dec 2012 10:43:13 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="16378"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 11a6b9e1139b6147dcda37070038e410a62856be X-Gm-Message-State: ALoCoQmw11PyT35ujH9J6VNtTNENiqX92/5BMTTzS/8W0CaFkh3c52RRkEotZN6jN012COt2kTV4 Merge authors: Milo Casagrande (milo) Related merge proposals: https://code.launchpad.net/~milo/linaro-image-tools/bug1085412/+merge/141324 proposed by: Milo Casagrande (milo) review: Approve - Fathi Boudra (fboudra) ------------------------------------------------------------ revno: 594 [merge] committer: Fathi Boudra branch nick: linaro-image-tools timestamp: Thu 2012-12-27 12:41:25 +0200 message: Added couple of tests for mmc_id field handling. modified: linaro_image_tools/hwpack/tests/test_config_v3.py linaro_image_tools/hwpack/tests/test_hwpack_converter.py --- lp:linaro-image-tools https://code.launchpad.net/~linaro-image-tools/linaro-image-tools/trunk You are subscribed to branch lp:linaro-image-tools. To unsubscribe from this branch go to https://code.launchpad.net/~linaro-image-tools/linaro-image-tools/trunk/+edit-subscription === 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:29:42 +0000 @@ -347,6 +347,13 @@ 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") === 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:29:42 +0000 @@ -166,3 +166,18 @@ 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))