コード例 #1
0
    def test_dut_commands(self):
        """Sanity check for the dut commands pass through."""
        config = ap_firmware.DeployConfig(self.get_commands)
        commands = config.get_servo_commands(self.servo, self.image)

        self.assertListEqual(self.expected_dut_on, commands.dut_on)
        self.assertListEqual(self.expected_dut_off, commands.dut_off)
コード例 #2
0
    def test_no_force_fast(self):
        """Sanity check no force fast function gets handled properly."""
        get_commands = lambda *args: ([], [], [], [])

        config = ap_firmware.DeployConfig(get_commands)
        self.assertFalse(config.force_fast(flashrom=False, servo=self.servo))
        self.assertFalse(config.force_fast(flashrom=True, servo=self.servo))
コード例 #3
0
    def test_futility_command(self):
        """Test the futility command is built correctly."""
        config = ap_firmware.DeployConfig(self.get_commands)
        commands = config.get_servo_commands(self.servo, self.image)

        self._assert_command(commands.flash,
                             flashrom=False,
                             fast_verbose=False)
コード例 #4
0
    def test_force_fast(self):
        """Test the force fast call-through."""
        get_commands = lambda *args: ([], [], [], [])
        force_fast = lambda futility, servo: futility and servo == self.servo

        config = ap_firmware.DeployConfig(get_commands, force_fast=force_fast)
        self.assertTrue(config.force_fast(flashrom=False, servo=self.servo))
        self.assertFalse(config.force_fast(flashrom=True, servo=self.servo))
コード例 #5
0
    def test_fast_verbose_futility(self):
        """Sanity check the fast/verbose futility arguments get added."""
        config = ap_firmware.DeployConfig(self.get_commands)
        commands = config.get_servo_commands(self.servo,
                                             self.image,
                                             fast=True,
                                             verbose=True)

        self._assert_command(commands.flash, flashrom=False, fast_verbose=True)
コード例 #6
0
    def test_force_fast_futility(self):
        """Test the futility and fast command alterations."""
        force_fast = lambda *args: True
        config = ap_firmware.DeployConfig(
            self.get_commands,
            force_fast=force_fast,
            servo_force_command=ap_firmware.DeployConfig.FORCE_FUTILITY)

        commands = config.get_servo_commands(self.servo,
                                             self.image,
                                             verbose=True)
        self._assert_command(commands.flash, flashrom=False, fast_verbose=True)