Ejemplo n.º 1
0
 def test__default(self):
     mock_run_smartctl = self.patch(smartctl, 'run_smartctl')
     blockdevice = factory.make_name('blockdevice')
     device = factory.make_name('device')
     smartctl.check_smartctl(blockdevice, device)
     self.assertThat(
         mock_run_smartctl,
         MockCalledOnceWith(blockdevice, ['--xall'],
                            device,
                            output=True,
                            stderr=STDOUT))
Ejemplo n.º 2
0
 def test_default(self):
     mock_run_smartctl = self.patch(smartctl, "run_smartctl")
     blockdevice = factory.make_name("blockdevice")
     device = factory.make_name("device")
     smartctl.check_smartctl(blockdevice, device)
     self.assertThat(
         mock_run_smartctl,
         MockCalledOnceWith(blockdevice, ["--xall"],
                            device,
                            output=True,
                            stderr=STDOUT),
     )
Ejemplo n.º 3
0
 def test__ignores_returncode_four(self):
     mock_run_smartctl = self.patch(smartctl, 'run_smartctl')
     mock_run_smartctl.side_effect = CalledProcessError(
         4, 'smartctl',
         factory.make_name('output').encode())
     blockdevice = factory.make_name('blockdevice')
     device = factory.make_name('device')
     smartctl.check_smartctl(blockdevice, device)
     self.assertThat(
         mock_run_smartctl,
         MockCalledOnceWith(blockdevice, ['--xall'],
                            device,
                            output=True,
                            stderr=STDOUT))
Ejemplo n.º 4
0
 def test_ignores_returncode_four(self):
     mock_run_smartctl = self.patch(smartctl, "run_smartctl")
     mock_run_smartctl.side_effect = CalledProcessError(
         4, "smartctl",
         factory.make_name("output").encode())
     blockdevice = factory.make_name("blockdevice")
     device = factory.make_name("device")
     smartctl.check_smartctl(blockdevice, device)
     self.assertThat(
         mock_run_smartctl,
         MockCalledOnceWith(blockdevice, ["--xall"],
                            device,
                            output=True,
                            stderr=STDOUT),
     )