Add new test, and extend create_plugin_component function
This commit is contained in:
parent
44eaacf1c7
commit
4345282d25
|
@ -23,7 +23,7 @@ class Network_components(PandoraWebDriverTestCase):
|
|||
test_description = u'Network components test'
|
||||
tickets_associated = []
|
||||
|
||||
def atest_A_create_network_component(self):
|
||||
def test_A_create_network_component(self):
|
||||
|
||||
u"""
|
||||
Create and search new network component module
|
||||
|
@ -73,7 +73,7 @@ class Network_components(PandoraWebDriverTestCase):
|
|||
self.assertEqual(network_component_name in driver.page_source,True)
|
||||
|
||||
|
||||
def atest_B_create_plugin_component(self):
|
||||
def test_B_create_plugin_component(self):
|
||||
|
||||
u"""
|
||||
Create and search new plug-in component
|
||||
|
@ -81,10 +81,6 @@ class Network_components(PandoraWebDriverTestCase):
|
|||
|
||||
driver = self.driver
|
||||
|
||||
self.login()
|
||||
|
||||
detect_and_pass_all_wizards(driver)
|
||||
|
||||
agent_name = gen_random_string(6)
|
||||
plugin_component_name = gen_random_string(6)
|
||||
|
||||
|
@ -132,9 +128,6 @@ class Network_components(PandoraWebDriverTestCase):
|
|||
|
||||
driver = self.driver
|
||||
|
||||
self.login()
|
||||
detect_and_pass_all_wizards(driver)
|
||||
|
||||
agent_name = gen_random_string(6)
|
||||
plugin_component_name = gen_random_string(6)
|
||||
|
||||
|
@ -173,6 +166,55 @@ class Network_components(PandoraWebDriverTestCase):
|
|||
search_module (driver,agent_name,plugin_component_name,go_to_module=False)
|
||||
|
||||
self.assertEqual(plugin_component_name in driver.page_source,True)
|
||||
|
||||
def test_D_plugin_component_with_parameters(self):
|
||||
|
||||
u"""
|
||||
Create and search new plug-in component with parameters
|
||||
"""
|
||||
|
||||
driver = self.driver
|
||||
|
||||
agent_name = gen_random_string(6)
|
||||
plugin_component_name = gen_random_string(6)
|
||||
|
||||
activate_api(driver,"1234")
|
||||
|
||||
params = [agent_name,"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)
|
||||
|
||||
create_plugin_component(driver,plugin_component_name,"Generic numeric","Network Management","Application",description="New plugin component",plugin="UDP port check",target_ip="127.0.0.1",port="80")
|
||||
|
||||
search_agent(driver,agent_name,go_to_agent=True)
|
||||
|
||||
driver.find_element_by_xpath('//ul[@class="mn"]/li/a/img[@data-title="Manage"]').click()
|
||||
driver.find_element_by_xpath('//ul[@class="mn"]/li/a/img[@data-title="Modules"]').click()
|
||||
|
||||
Select(driver.find_element_by_id("moduletype")).select_by_visible_text("Create a new plug-in server module")
|
||||
|
||||
driver.find_element_by_xpath('//*[@id="main"]/form/table/tbody/tr/td[5]/input').click()
|
||||
|
||||
driver.find_element_by_xpath('//a[contains(.,"Advanced options")]').click()
|
||||
|
||||
Select(driver.find_element_by_id("network_component_group")).select_by_visible_text("Network Management")
|
||||
|
||||
time.sleep(3)
|
||||
|
||||
Select(driver.find_element_by_id("network_component")).select_by_visible_text(plugin_component_name)
|
||||
|
||||
driver.find_element_by_id("submit-crtbutton").click()
|
||||
|
||||
search_module (driver,agent_name,plugin_component_name,go_to_module=True)
|
||||
|
||||
self.assertEqual("127.0.0.1" in driver.page_source,True)
|
||||
|
||||
self.assertEqual("80" in driver.page_source,True)
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest2.main()
|
||||
|
|
|
@ -78,9 +78,10 @@ def create_network_component(driver,name,type_component,group,module_group,min_w
|
|||
|
||||
driver.find_element_by_id("submit-crt").click()
|
||||
|
||||
def create_plugin_component(driver,name,type_component,group,module_group,min_warning=None,max_warning=None,min_critical=None,max_critical=None,str_warning=None,str_critical=None,description=None):
|
||||
def create_plugin_component(driver,name,type_component,group,module_group,min_warning=None,max_warning=None,min_critical=None,max_critical=None,str_warning=None,str_critical=None,description=None,plugin=None,target_ip=None,port=None):
|
||||
|
||||
# type_component is for example -> Generic boolean or Generic numeric incremental (absolute)
|
||||
#Variable plugin is for example -> SMTP Check or UDP port check
|
||||
|
||||
click_menu_element(driver,"Network components")
|
||||
|
||||
|
@ -144,6 +145,19 @@ def create_plugin_component(driver,name,type_component,group,module_group,min_wa
|
|||
driver.find_element_by_id("textarea_description").clear()
|
||||
driver.find_element_by_id("textarea_description").send_keys(description)
|
||||
|
||||
|
||||
if plugin != None:
|
||||
|
||||
driver.find_element_by_xpath('//option[contains(.,"'+plugin+'")]').click()
|
||||
|
||||
if plugin == "UDP port check":
|
||||
|
||||
driver.find_element_by_id("text-_field1_").clear()
|
||||
driver.find_element_by_id("text-_field1_").send_keys(target_ip)
|
||||
|
||||
driver.find_element_by_id("text-_field2_").clear()
|
||||
driver.find_element_by_id("text-_field2_").send_keys(port)
|
||||
|
||||
driver.find_element_by_id("submit-crt").click()
|
||||
|
||||
def create_wmi_component(driver,name,type_component,group,module_group,min_warning=None,max_warning=None,min_critical=None,max_critical=None,str_warning=None,str_critical=None,description=None):
|
||||
|
|
Loading…
Reference in New Issue