Add new test, edit agent description with bulk operation

(cherry picked from commit f6afd533dc)
This commit is contained in:
cesar991 2016-09-13 09:48:10 +02:00
parent 6981aa7ba4
commit 9c88d21b08
2 changed files with 32 additions and 2 deletions

View File

@ -51,7 +51,6 @@ class Bulk_operations(PandoraWebDriverTestCase):
self.assertRegexpMatches(self.close_alert_and_get_its_text(), r"^Are you sure[\s\S]$")
self.assertEqual(self.driver.find_element_by_xpath('//div[@id="main"]//td[contains(.,"Successfully deleted (2)")]').text,"Successfully deleted (2)")
def test_B_edit_agents_group_bulk_operations(self):
@ -85,6 +84,37 @@ class Bulk_operations(PandoraWebDriverTestCase):
self.assertRegexpMatches(self.close_alert_and_get_its_text(), r"^Are you sure[\s\S]$")
self.assertEqual(self.driver.find_element_by_xpath('//div[@id="main"]//td[contains(.,"Agents updated successfully(2)")]').text,"Agents updated successfully(2)")
def test_C_edit_agent_description_bulk_operation(self):
u"""
Create two agents and edit description with bulk operation
"""
agent_name_1 = gen_random_string(6)
agent_name_2 = 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")
lista = driver.current_url.split('/')
url = lista[0]+'//'+lista[2]+'/pandora_console'
driver.get(url)
agent_names_list = [agent_name_1,agent_name_2]
edit_agents_in_bulk(driver,agent_names_list,new_description="test C edit description bulk operation")
self.assertRegexpMatches(self.close_alert_and_get_its_text(), r"^Are you sure[\s\S]$")
self.assertEqual(self.driver.find_element_by_xpath('//div[@id="main"]//td[contains(.,"Agents updated successfully(2)")]').text,"Agents updated successfully(2)")
if __name__ == "__main__":
unittest.main()

View File

@ -33,7 +33,7 @@ def edit_agents_in_bulk(driver,agent_names_list,new_group=None,new_description=N
time.sleep(3)
if new_group != None:
#driver.find_element_by_id("group").click()
Select(driver.find_element_by_id("group")).select_by_visible_text(new_group)
if new_description != None: