Add test Apply_policy_to_agents_with_spaces in Policies.py

This commit is contained in:
cesar991 2016-09-28 09:37:48 +02:00
parent 4416785e75
commit 113b77bf9f
1 changed files with 53 additions and 0 deletions

View File

@ -128,6 +128,59 @@ class Policies(PandoraWebDriverTestCase):
module = driver.find_element_by_xpath('//td[contains(.,"'+module_name_2+'")]')
self.assertIsInstance(module,WebElement)
@is_enterprise
def test_E_Apply_policy_to_agents_with_spaces(self):
u"""
Create a policy and two agents with spaces in name, apply policy in this agents and check that this it works
"""
policy_name = gen_random_string(6)
agent_name_1 = "test agent 1"
agent_name_2 = "test agent 2"
agent_name_3 = "test agent 3"
module_name = gen_random_string(6)
driver = self.driver
create_agent(driver,agent_name_1,description="First agent by test")
create_agent(driver,agent_name_2,description="Second agent by test")
create_agent(driver,agent_name_3,description="Third agent by test")
create_policy(driver,policy_name,"Applications",description="This is policy by test")
add_module_policy(driver,policy_name,"network_server",driver,module_name=module_name,component_group="Network Management",network_component="Host Alive")
list_agent = (agent_name_1,agent_name_2,agent_name_3)
apply_policy_to_agent(driver,policy_name,list_agent)
search_agent(driver,agent_name_1,go_to_agent=True)
driver.find_element_by_xpath('//*[@id="menu_tab"]/ul//img[@data-title="Manage"]').click()
driver.find_element_by_xpath('//ul[@class="mn"]/li/a/img[@data-title="Modules"]').click()
module = driver.find_element_by_xpath('//td[contains(.,"'+module_name+'")]')
self.assertIsInstance(module,WebElement)
search_agent(driver,agent_name_2,go_to_agent=True)
driver.find_element_by_xpath('//*[@id="menu_tab"]/ul//img[@data-title="Manage"]').click()
driver.find_element_by_xpath('//ul[@class="mn"]/li/a/img[@data-title="Modules"]').click()
module = driver.find_element_by_xpath('//td[contains(.,"'+module_name+'")]')
self.assertIsInstance(module,WebElement)
search_agent(driver,agent_name_3,go_to_agent=True)
driver.find_element_by_xpath('//*[@id="menu_tab"]/ul//img[@data-title="Manage"]').click()
driver.find_element_by_xpath('//ul[@class="mn"]/li/a/img[@data-title="Modules"]').click()
module = driver.find_element_by_xpath('//td[contains(.,"'+module_name+'")]')
self.assertIsInstance(module,WebElement)
if __name__ == "__main__":
unittest2.main()