Beispiel #1
0
 def test__issue_ipmipower_command_does_not_mistake_host_for_status(self):
     popen_mock = self.patch(ipmi_module, 'Popen')
     process = popen_mock.return_value
     # "cameron" contains the string "on", but the machine is off.
     process.communicate.return_value = (b'cameron: off', b'')
     process.returncode = 0
     self.assertThat(
         IPMIPowerDriver._issue_ipmipower_command(
             factory.make_name('command'), 'query',
             factory.make_name('address')), Equals("off"))
Beispiel #2
0
 def test_issue_ipmipower_command_does_not_mistake_host_for_status(self):
     run_command_mock = self.patch(ipmi_module.shell, "run_command")
     # "cameron" contains the string "on", but the machine is off.
     run_command_mock.return_value = ProcessResult(stdout="cameron: off")
     self.assertThat(
         IPMIPowerDriver._issue_ipmipower_command(
             factory.make_name("command"),
             "query",
             factory.make_name("address"),
         ),
         Equals("off"),
     )