Beispiel #1
0
 def test_power_query_returns_power_state_on(self):
     driver = MSCMPowerDriver()
     system_id = factory.make_name("system_id")
     context = make_context()
     run_mscm_command = self.patch(driver, "run_mscm_command")
     run_mscm_command.return_value = (
         "show node power c1n1\r\r\n\r\nCartridge #1\r\n  Node #1\r\n"
         "        Power State: On\r\n")
     output = driver.power_query(system_id, context)
     self.assertThat(output, Equals("on"))
Beispiel #2
0
 def test_power_query_returns_power_state(self, power_state):
     states = {"Off": "off", "Unavailable": "off", "On": "on"}
     driver = MSCMPowerDriver()
     system_id = factory.make_name("system_id")
     context = make_context()
     run_mscm_command = self.patch(driver, "run_mscm_command")
     run_mscm_command.return_value = (
         "show node power c1n1\r\r\n\r\nCartridge #1\r\n  Node #1\r\n"
         "        Power State: %s\r\n" % power_state)
     output = driver.power_query(system_id, context)
     self.assertThat(output, Equals(states[power_state]))