def test_no_change(self): api = make_api() server = make_server() self.patch(ucsm, "get_service_profile") self.patch(api, "config_resolve_children") self.patch(ucsm, "make_policy_change").return_value = None config_conf_mo = self.patch(api, "config_conf_mo") set_lan_boot_default(api, server) self.assertThat(config_conf_mo, MockNotCalled())
def test_with_change(self): api = make_api() server = make_server() test_dn = make_dn() test_change = 'change' service_profile = Element('test', {'operBootPolicyName': test_dn}) self.patch(ucsm, 'get_service_profile').return_value = service_profile self.patch(api, 'config_resolve_children') self.patch(ucsm, 'make_policy_change').return_value = test_change config_conf_mo = self.patch(api, 'config_conf_mo') set_lan_boot_default(api, server) self.assertThat(config_conf_mo, MockCalledOnceWith(test_dn, [test_change]))
def test_with_change(self): api = make_api() server = make_server() test_dn = make_dn() test_change = "change" service_profile = Element("test", {"operBootPolicyName": test_dn}) self.patch(ucsm, "get_service_profile").return_value = service_profile self.patch(api, "config_resolve_children") self.patch(ucsm, "make_policy_change").return_value = test_change config_conf_mo = self.patch(api, "config_conf_mo") set_lan_boot_default(api, server) self.assertThat(config_conf_mo, MockCalledOnceWith(test_dn, [test_change]))