def teardown_class(cls): """ This method is called once when all tests have been done. It restores the saved configuration. """ # If the ruleset used exists, we delete it for ruleset in cls.client.call('ufwi_ruleset', 'rulesetList', 'ruleset'): if cls.ruleV4['name'] in ruleset: cls.client.call('ufwi_ruleset', 'rulesetDelete', 'ruleset', cls.ruleV4['name']) break # If there was any ruleset open, now we close it try: cls.client.call('ufwi_ruleset', 'rulesetClose') except RpcdError: pass # If the previous ruleset still exists, we restore it if cls.origRuleset: for ruleset in cls.client.call('ufwi_ruleset', 'rulesetList', 'ruleset'): if 'origRuleset' in ruleset: cls.client.call('ufwi_ruleset', 'rulesetOpen', 'ruleset', cls.origRuleset) cls.client.call('ufwi_ruleset', 'applyRules', 'True', 'True') cls.client.call('ufwi_ruleset', 'rulesetClose') break # Retour a la configuration initiale cls.client.call('network', 'setNetconfig', cls.orig, 'pas de message') cls.apply_ufwi_conf() Test.teardown_class()
def teardown_class(cls): """ This method is called once when all tests have been done. It restores the saved configuration. """ if cls.with_ha: cls.ssh_client.close() Test.teardown_class()
def teardown_class(cls): """ This method is called once when all tests have been done. It restores the saved configuration. """ cls.client.call('network', 'setNetconfig', cls.orig, 'pas de message') cls.apply_nuconf() Test.teardown_class()
def teardown_class(cls): """ This method is called once when all tests have been done. It restores the saved configuration. """ # Retour a la configuration initiale cls.client.call("network", "setNetconfig", cls.orig, "pas de message") cls.apply_nuconf() Test.teardown_class()
def teardown_class(cls): """ This method is called once when all tests have been done. It restores the saved configuration. """ # Clean after our tests cls.takeNuconfWriteRole() cls.client.call('openvpn', 'setOpenVpnConfig', cls.orig, 'test openvpn - restore orginal configuration') cls.apply_nuconf() cls.client.call('nupki', 'deletePKI', cls.PKI_TEST['name']) Test.teardown_class()
def teardown_class(cls): """ This method is called once when all tests have been done. It restores the saved configuration. """ # Here, unlike other test classes, we won't restore the old # configuration for at least 2 reasons : # 1. The original user directory configuration may be invalid (like in # a fresh install) # 2. The original user directory configuration may be an Active # Directory one, and these take a loooooooooooong time to join. #cls.client.call('nuauth','setNuauthConfig',cls.orig,'pas de message') #cls.client.call('config','apply') cls.client.call('hostname', 'setShortHostname', cls.old_hostname, 'teardown : hostname') cls.apply_nuconf() Test.teardown_class()
def teardown_class(cls): """ This method is called once when all tests have been done. It restores the saved configuration. """ # Clean after our tests cls.client.call('network', 'setNetconfig', cls.net_orig, 'pas de message') cls.client.call('dhcp', 'setDhcpConfig', cls.dhcp_orig, "Add a dhcp range for testing purposes") cls.apply_nuconf() Test.teardown_class()
def teardown_class(cls): """ This method is called once when all tests have been done. It restores the saved configuration. """ with open("/sys/class/net/eth0/operstate","r") as handle: eth0_state = handle.readlines() cls.client.call('network', 'setNetconfig', cls.orig, 'pas de message') cls.apply_nuconf() # Let's check that eth0 isn't affected by our changes with open("/sys/class/net/eth0/operstate","r") as handle: state = handle.readlines() assert eth0_state == state, "eth0 changes when it shouldn't" Test.teardown_class()
def teardown_class(cls): """ This method is called once when all tests have been done. It restores the saved configuration. """ cls.client.call('network','setNetconfig',cls.orig,'pas de message') cls.client.call('config','apply') cls.client.logout() # Let's check that eth0 isn't affected by our changes a = 0 while a < 200: with open("/sys/class/net/eth0/operstate","r") as fd: state = fd.readlines() assert "up\n" in state, "eth0 changes when it shouldn't" sleep(0.2) a+=1 Test.cleanMyDir(cls.test_path) Test.teardown_class()
def teardown_class(cls): """ This method is called once when all tests have been done. It restores the saved configuration. """ Test.teardown_class()