def test_set_firewall_settings_remotemgmt_local_enable(self): current = win_lgpo_netsh.get_settings( profile='domain', section='settings', store='local')['RemoteManagement'] try: ret = win_lgpo_netsh.set_settings(profile='domain', setting='remotemanagement', value='enable', store='local') self.assertTrue(ret) new = win_lgpo_netsh.get_settings( profile='domain', section='settings', store='local')['RemoteManagement'] self.assertEqual('Enable', new) finally: ret = win_lgpo_netsh.set_settings(profile='domain', setting='remotemanagement', value=current, store='local') self.assertTrue(ret)
def test_set_firewall_settings_fwrules_lgpo_notconfigured(self): current = win_lgpo_netsh.get_settings( profile='domain', section='settings', store='lgpo')['LocalFirewallRules'] try: ret = win_lgpo_netsh.set_settings(profile='domain', setting='localfirewallrules', value='notconfigured', store='lgpo') self.assertTrue(ret) new = win_lgpo_netsh.get_settings( profile='domain', section='settings', store='lgpo')['LocalFirewallRules'] self.assertEqual('NotConfigured', new) finally: ret = win_lgpo_netsh.set_settings(profile='domain', setting='localfirewallrules', value=current, store='lgpo') self.assertTrue(ret)
def test_set_firewall_settings_unicast_local_disable(self): current = win_lgpo_netsh.get_settings( profile='domain', section='settings', store='local')['UnicastResponseToMulticast'] try: ret = win_lgpo_netsh.set_settings( profile='domain', setting='unicastresponsetomulticast', value='disable', store='local') self.assertTrue(ret) new = win_lgpo_netsh.get_settings( profile='domain', section='settings', store='local')['UnicastResponseToMulticast'] self.assertEqual('Disable', new) finally: ret = win_lgpo_netsh.set_settings( profile='domain', setting='unicastresponsetomulticast', value=current, store='local') self.assertTrue(ret)
def test_set_firewall_settings_notification_lgpo_notconfigured(self): current = win_lgpo_netsh.get_settings( profile='domain', section='settings', store='lgpo')['InboundUserNotification'] try: ret = win_lgpo_netsh.set_settings( profile='domain', setting='inboundusernotification', value='notconfigured', store='lgpo') self.assertTrue(ret) new = win_lgpo_netsh.get_settings( profile='domain', section='settings', store='lgpo')['InboundUserNotification'] self.assertEqual('NotConfigured', new) finally: ret = win_lgpo_netsh.set_settings( profile='domain', setting='inboundusernotification', value=current, store='lgpo') self.assertTrue(ret)
def test_set_firewall_settings_unicast_local_disable(self): current = win_lgpo_netsh.get_settings( profile="domain", section="settings", store="local")["UnicastResponseToMulticast"] try: ret = win_lgpo_netsh.set_settings( profile="domain", setting="unicastresponsetomulticast", value="disable", store="local", ) self.assertTrue(ret) new = win_lgpo_netsh.get_settings( profile="domain", section="settings", store="local")["UnicastResponseToMulticast"] self.assertEqual("Disable", new) finally: ret = win_lgpo_netsh.set_settings( profile="domain", setting="unicastresponsetomulticast", value=current, store="local", ) self.assertTrue(ret)
def test_set_firewall_settings_remotemgmt_local_enable(self): current = win_lgpo_netsh.get_settings( profile="domain", section="settings", store="local")["RemoteManagement"] try: ret = win_lgpo_netsh.set_settings( profile="domain", setting="remotemanagement", value="enable", store="local", ) self.assertTrue(ret) new = win_lgpo_netsh.get_settings( profile="domain", section="settings", store="local")["RemoteManagement"] self.assertEqual("Enable", new) finally: ret = win_lgpo_netsh.set_settings( profile="domain", setting="remotemanagement", value=current, store="local", ) self.assertTrue(ret)
def test_set_firewall_settings_notification_lgpo_notconfigured(self): current = win_lgpo_netsh.get_settings( profile="domain", section="settings", store="lgpo")["InboundUserNotification"] try: ret = win_lgpo_netsh.set_settings( profile="domain", setting="inboundusernotification", value="notconfigured", store="lgpo", ) self.assertTrue(ret) new = win_lgpo_netsh.get_settings( profile="domain", section="settings", store="lgpo")["InboundUserNotification"] self.assertEqual("NotConfigured", new) finally: ret = win_lgpo_netsh.set_settings( profile="domain", setting="inboundusernotification", value=current, store="lgpo", ) self.assertTrue(ret)
def test_set_firewall_settings_notification_local_enable(self): current = win_lgpo_netsh.get_settings( profile="domain", section="settings", store="local")["InboundUserNotification"] try: ret = win_lgpo_netsh.set_settings( profile="domain", setting="inboundusernotification", value="enable", store="local", ) self.assertTrue(ret) new = win_lgpo_netsh.get_settings( profile="domain", section="settings", store="local")["InboundUserNotification"] self.assertEqual("Enable", new) finally: ret = win_lgpo_netsh.set_settings( profile="domain", setting="inboundusernotification", value=current, store="local", ) self.assertTrue(ret)
def test_set_firewall_settings_fwrules_lgpo_notconfigured(self): current = win_lgpo_netsh.get_settings( profile="domain", section="settings", store="lgpo")["LocalFirewallRules"] try: ret = win_lgpo_netsh.set_settings( profile="domain", setting="localfirewallrules", value="notconfigured", store="lgpo", ) self.assertTrue(ret) new = win_lgpo_netsh.get_settings( profile="domain", section="settings", store="lgpo")["LocalFirewallRules"] self.assertEqual("NotConfigured", new) finally: ret = win_lgpo_netsh.set_settings( profile="domain", setting="localfirewallrules", value=current, store="lgpo", ) self.assertTrue(ret)
def test_set_firewall_settings_notification_local_notconfigured(self): current = win_lgpo_netsh.get_settings( profile='domain', section='settings', store='local')['InboundUserNotification'] try: self.assertRaises(CommandExecutionError, win_lgpo_netsh.set_settings, profile='domain', setting='inboundusernotification', value='notconfigured', store='local') finally: ret = win_lgpo_netsh.set_settings( profile='domain', setting='inboundusernotification', value=current, store='local') self.assertTrue(ret)
def test_set_firewall_settings_notification_local_notconfigured(self): current = win_lgpo_netsh.get_settings( profile="domain", section="settings", store="local")["InboundUserNotification"] try: self.assertRaises( CommandExecutionError, win_lgpo_netsh.set_settings, profile="domain", setting="inboundusernotification", value="notconfigured", store="local", ) finally: ret = win_lgpo_netsh.set_settings( profile="domain", setting="inboundusernotification", value=current, store="local", ) self.assertTrue(ret)