From 90aeaf0f300fc5739d59153a27a2fd96613a6950 Mon Sep 17 00:00:00 2001 From: cesar991 Date: Mon, 26 Sep 2016 16:36:49 +0200 Subject: [PATCH] Add changes in pandora_6.0 of the commit 0b696e9c3b45a949b603bb1ee580fece17a9a6fe --- tests/console/Bulk_operations.py | 49 ++++++++++++++++++++++++ tests/console/include/bulk_operations.py | 6 +-- 2 files changed, 51 insertions(+), 4 deletions(-) diff --git a/tests/console/Bulk_operations.py b/tests/console/Bulk_operations.py index 281e849966..4cf146f8a2 100644 --- a/tests/console/Bulk_operations.py +++ b/tests/console/Bulk_operations.py @@ -323,6 +323,55 @@ class Bulk_operations(PandoraWebDriverTestCase): element = driver.find_element_by_xpath('//tr//td[contains(.,"2")]') self.assertIsInstance(element,WebElement) + def test_H_copy_modules_in_bulk(self): + + u""" + Create three agents One of them with a module. Through a bulk operation, copy this module in other two agents + """ + + agent_name_1 = gen_random_string(6) + agent_name_2 = gen_random_string(6) + agent_name_3 = gen_random_string(6) + + module_name_1 = gen_random_string(6) + + driver = self.driver + + activate_api(driver,"1234") + + params = [agent_name_1,"127.0.0.1","0","4","0","300","2","pandorafms","2","0","0","pruebas"] + create_agent_api(driver,params,user="admin",pwd="pandora") + + params = [agent_name_2,"127.0.0.1","0","4","0","300","2","pandorafms","2","0","0","pruebas"] + create_agent_api(driver,params,user="admin",pwd="pandora") + + params = [agent_name_3,"127.0.0.1","0","4","0","300","2","pandorafms","2","0","0","pruebas"] + create_agent_api(driver,params,user="admin",pwd="pandora") + + params = [agent_name_1,module_name_1,"0","6","1","0","0","0","0","0","0","0","0","129.99.40.1","0","0","180","0","0","0","0","Host_Alive"] + add_network_module_to_agent_api(driver,params,user="admin",pwd="pandora",apipwd="1234") + + lista = driver.current_url.split('/') + + url = lista[0]+'//'+lista[2]+'/pandora_console' + + driver.get(url) + + destiny_agents_list = [agent_name_2,agent_name_3] + + module_list = [module_name_1] + + agent_name = agent_name_1.lower() + + copy_modules_in_bulk(driver,agent_name,module_list,destiny_agents_list) + + search_module(driver,agent_name_2,module_name_1) + + self.assertEqual(module_name_1 in driver.page_source,True) + + search_module(driver,agent_name_3,module_name_1) + + self.assertEqual(module_name_1 in driver.page_source,True) if __name__ == "__main__": unittest.main() diff --git a/tests/console/include/bulk_operations.py b/tests/console/include/bulk_operations.py index 1cffa20864..4788d85118 100644 --- a/tests/console/include/bulk_operations.py +++ b/tests/console/include/bulk_operations.py @@ -98,8 +98,6 @@ def copy_modules_in_bulk(driver,owner_agent_name,module_name_list,destiny_agents Select(driver.find_element_by_id("option")).select_by_visible_text("Copy modules in bulk") time.sleep(2) - driver.find_element_by_id("source_id_agent").click() - Select(driver.find_element_by_id("source_id_agent")).select_by_visible_text(owner_agent_name) time.sleep(3) @@ -110,9 +108,9 @@ def copy_modules_in_bulk(driver,owner_agent_name,module_name_list,destiny_agents for agent_name in destiny_agents_list: Select(driver.find_element_by_id("destiny_id_agent")).select_by_visible_text(agent_name) - driver.find_element_by_id("submit-go").click() - + alert = driver.switch_to_alert() + alert.accept() def edit_modules_in_bulk(driver,module_name_list,agent_name_list,new_module_group=None,new_min=None,new_max=None,ff_threshold_list=None):