Esempio n. 1
0
    def test_power_state_get_on(self):
        url = factory.make_name('url')
        username = factory.make_name('username')
        password = factory.make_name('password')
        uuid = factory.make_UUID()
        api = Mock()
        self.patch(ucsm, 'UCSM_XML_API').return_value = api
        get_servers_mock = self.patch(ucsm, 'get_servers')
        get_servers_mock.return_value = [make_server("on")]

        power_state = power_state_ucsm(url, username, password, uuid)
        self.expectThat(get_servers_mock, MockCalledOnceWith(api, uuid))
        self.expectThat(power_state, Equals('on'))
Esempio n. 2
0
    def test_power_state_get_on(self):
        url = factory.make_name("url")
        username = factory.make_name("username")
        password = factory.make_name("password")
        uuid = factory.make_UUID()
        api = Mock()
        self.patch(ucsm, "UCSM_XML_API").return_value = api
        get_servers_mock = self.patch(ucsm, "get_servers")
        get_servers_mock.return_value = [make_server("on")]

        power_state = power_state_ucsm(url, username, password, uuid)
        self.expectThat(get_servers_mock, MockCalledOnceWith(api, uuid))
        self.expectThat(power_state, Equals("on"))
Esempio n. 3
0
 def power_query(self, system_id, context):
     """Power query UCSM node."""
     url, username, password, uuid = extract_ucsm_parameters(context)
     return power_state_ucsm(url, username, password, uuid)