Add new test in Bulk_operations file and repair errors
(cherry picked from commit bb686bcbd7
)
Conflicts:
tests/console/Bulk_operations.py
This commit is contained in:
parent
b4f8926e75
commit
58de8a8fbf
|
@ -268,6 +268,61 @@ class Bulk_operations(PandoraWebDriverTestCase):
|
||||||
element = driver.find_element_by_xpath('//tr//td[contains(.,"2")]')
|
element = driver.find_element_by_xpath('//tr//td[contains(.,"2")]')
|
||||||
self.assertIsInstance(element,WebElement)
|
self.assertIsInstance(element,WebElement)
|
||||||
|
|
||||||
|
def test_G_edit_module_threshold_in_bulk(self):
|
||||||
|
|
||||||
|
u"""
|
||||||
|
Create two agents and one module in this agents. With bulk operation, change FF Threshold with bulk operation
|
||||||
|
Ticket Associated = 4059
|
||||||
|
"""
|
||||||
|
|
||||||
|
agent_name_1 = gen_random_string(6)
|
||||||
|
agent_name_2 = 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_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")
|
||||||
|
|
||||||
|
params = [agent_name_2,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)
|
||||||
|
|
||||||
|
agent_name_list = [agent_name_1,agent_name_2]
|
||||||
|
|
||||||
|
module_name_list = [module_name_1]
|
||||||
|
|
||||||
|
ff_threshold_list = [0,1,2]
|
||||||
|
|
||||||
|
edit_modules_in_bulk(driver,module_name_list,agent_name_list,ff_threshold_list=ff_threshold_list)
|
||||||
|
|
||||||
|
self.assertRegexpMatches(self.close_alert_and_get_its_text(), r"^Are you sure[\s\S]$")
|
||||||
|
search_module(driver,agent_name_1,module_name_1,go_to_module=True)
|
||||||
|
|
||||||
|
driver.find_element_by_xpath('//a[contains(.,"Advanced options")]').click()
|
||||||
|
|
||||||
|
element = driver.find_element_by_xpath('//tr//td[contains(.,"0")]')
|
||||||
|
self.assertIsInstance(element,WebElement)
|
||||||
|
|
||||||
|
element = driver.find_element_by_xpath('//tr//td[contains(.,"1")]')
|
||||||
|
self.assertIsInstance(element,WebElement)
|
||||||
|
|
||||||
|
element = driver.find_element_by_xpath('//tr//td[contains(.,"2")]')
|
||||||
|
self.assertIsInstance(element,WebElement)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
|
@ -122,16 +122,18 @@ def edit_modules_in_bulk(driver,module_name_list,agent_name_list,new_module_grou
|
||||||
|
|
||||||
if ff_threshold_list != None:
|
if ff_threshold_list != None:
|
||||||
|
|
||||||
Select(driver.find_element_by_id("option")).select_by_visible_text("Change each status")
|
Select(driver.find_element_by_id("each_ff")).select_by_visible_text("Change each status")
|
||||||
|
|
||||||
|
time.sleep(3)
|
||||||
|
|
||||||
driver.find_element_by_id("text-min_ff_event_normal").clear()
|
driver.find_element_by_id("text-min_ff_event_normal").clear()
|
||||||
Select(driver.find_element_by_id("text-min_ff_event_normal")).select_by_visible_text(ff_threshold_list[0])
|
driver.find_element_by_id("text-min_ff_event_normal").send_keys(ff_threshold_list[0])
|
||||||
|
|
||||||
driver.find_element_by_id("text-min_ff_event_warning").clear()
|
driver.find_element_by_id("text-min_ff_event_warning").clear()
|
||||||
Select(driver.find_element_by_id("text-min_ff_event_warning")).select_by_visible_text(ff_threshold_list[1])
|
driver.find_element_by_id("text-min_ff_event_warning").send_keys(ff_threshold_list[1])
|
||||||
|
|
||||||
driver.find_element_by_id("text-min_ff_event_critical").clear()
|
driver.find_element_by_id("text-min_ff_event_critical").clear()
|
||||||
Select(driver.find_element_by_id("text-min_ff_event_critical")).select_by_visible_text(ff_threshold_list[2])
|
driver.find_element_by_id("text-min_ff_event_critical").send_keys(ff_threshold_list[2])
|
||||||
|
|
||||||
driver.find_element_by_id("submit-go").click()
|
driver.find_element_by_id("submit-go").click()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue