Add a new tests file Network_components.py and repair errors in network_components_functions.py
(cherry picked from commit c3d07bfe12
)
This commit is contained in:
parent
9aa182ddf3
commit
b88c2a5aae
|
@ -0,0 +1,82 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from include.common_classes_60 import PandoraWebDriverTestCase
|
||||
from include.common_functions_60 import login, click_menu_element, detect_and_pass_all_wizards, gen_random_string
|
||||
from include.agent_functions import search_agent,create_agent,delete_agent
|
||||
from include.api_functions import *
|
||||
from include.module_functions import search_module
|
||||
from include.network_components_functions import *
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
from selenium.webdriver.support.ui import Select
|
||||
from selenium.common.exceptions import NoSuchElementException
|
||||
from selenium.common.exceptions import NoAlertPresentException
|
||||
from selenium.webdriver.remote.webelement import WebElement
|
||||
|
||||
import unittest2, time, re
|
||||
|
||||
|
||||
class PAN13(PandoraWebDriverTestCase):
|
||||
|
||||
|
||||
test_name = u'Planned_downtime'
|
||||
test_description = u'Planed downtime test'
|
||||
tickets_associated = []
|
||||
|
||||
def test_A_create_network_component(self):
|
||||
|
||||
u"""
|
||||
Create and search new network component module
|
||||
"""
|
||||
|
||||
driver = self.driver
|
||||
self.login()
|
||||
detect_and_pass_all_wizards(driver)
|
||||
|
||||
agent_name = gen_random_string(6)
|
||||
network_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_network_component(driver,network_component_name,"Remote TCP network agent, boolean data","Network Management","Application",min_warning=10,max_critical=100,description="New network component by test")
|
||||
|
||||
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 network 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(network_component_name)
|
||||
|
||||
driver.find_element_by_id("submit-crtbutton").click()
|
||||
|
||||
search_module (driver,agent_name,network_component_name,go_to_module=False)
|
||||
|
||||
self.assertEqual(network_component_name in driver.page_source,True)
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest2.main()
|
||||
|
||||
|
||||
|
||||
|
|
@ -10,7 +10,7 @@ import random, time
|
|||
import string
|
||||
|
||||
|
||||
def create_network_component(driver,name,type_component,group,module_group,min_warning=None,max_warning=None,description=None):
|
||||
def create_network_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):
|
||||
|
||||
# type_component is for example -> Remote ICMP network agent (latency) or Remote TCP network agent, numeric data
|
||||
|
||||
|
@ -18,6 +18,8 @@ def create_network_component(driver,name,type_component,group,module_group,min_w
|
|||
|
||||
driver.find_element_by_id("id_component_type").click()
|
||||
Select(driver.find_element_by_id("id_component_type")).select_by_visible_text("Create a new network component")
|
||||
|
||||
driver.find_element_by_id("submit-crt").click()
|
||||
|
||||
driver.find_element_by_id("text-name").click()
|
||||
driver.find_element_by_id("text-name").clear()
|
||||
|
@ -76,14 +78,16 @@ 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,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):
|
||||
|
||||
# Type is for example -> Generic boolean or Generic numeric incremental (absolute)
|
||||
# type_component is for example -> Generic boolean or Generic numeric incremental (absolute)
|
||||
|
||||
click_menu_element(driver,"Network components")
|
||||
|
||||
driver.find_element_by_id("id_component_type").click()
|
||||
Select(driver.find_element_by_id("id_component_type")).select_by_visible_text("Create a new plug-in component")
|
||||
|
||||
driver.find_element_by_id("submit-crt").click()
|
||||
|
||||
driver.find_element_by_id("text-name").click()
|
||||
driver.find_element_by_id("text-name").clear()
|
||||
|
|
Loading…
Reference in New Issue