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))
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), )
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))
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), )