def test_power_query_queries_off(self): driver = RedfishPowerDriver() power_change = "Off" system_id = factory.make_name('system_id') context = make_context() mock_redfish_request = self.patch(driver, 'redfish_request') mock_redfish_request.return_value = (SAMPLE_JSON_SYSTEM, None) power_state = yield driver.power_query(system_id, context) self.assertEquals(power_state, power_change.lower())
def test_power_query_queries_on(self): driver = RedfishPowerDriver() power_change = "On" system_id = factory.make_name('system_id') context = make_context() mock_redfish_request = self.patch(driver, 'redfish_request') NODE_POWERED_ON = deepcopy(SAMPLE_JSON_SYSTEM) NODE_POWERED_ON['PowerState'] = "On" mock_redfish_request.return_value = (NODE_POWERED_ON, None) power_state = yield driver.power_query(system_id, context) self.assertEquals(power_state, power_change.lower())
def test_power_query_queries_off(self): driver = RedfishPowerDriver() power_change = "Off" system_id = factory.make_name("system_id") context = make_context() mock_redfish_request = self.patch(driver, "redfish_request") mock_redfish_request.side_effect = [ (SAMPLE_JSON_SYSTEMS, None), (SAMPLE_JSON_SYSTEM, None), ] power_state = yield driver.power_query(system_id, context) self.assertEquals(power_state, power_change.lower())
def test_power_query_queries_on(self): driver = RedfishPowerDriver() power_change = "On" system_id = factory.make_name("system_id") context = make_context() mock_redfish_request = self.patch(driver, "redfish_request") NODE_POWERED_ON = deepcopy(SAMPLE_JSON_SYSTEM) NODE_POWERED_ON["PowerState"] = "On" mock_redfish_request.side_effect = [ (SAMPLE_JSON_SYSTEMS, None), (NODE_POWERED_ON, None), ] power_state = yield driver.power_query(system_id, context) self.assertEquals(power_state, power_change.lower())