Fixed test PAN_8 and add_user_profile function
This commit is contained in:
parent
bf320d30b7
commit
2b5e5dbc75
|
@ -26,37 +26,37 @@ class PAN8(PandoraWebDriverTestCase):
|
|||
|
||||
create_agent(driver,"PAN_8",group="Applications",ip="192.168.50.50")
|
||||
|
||||
#Creamos modulo without tag
|
||||
#We create a module without a tag
|
||||
|
||||
create_network_server_module(driver,"PAN_8",module_name="Without tag",component_group="Network Management",network_component="Host Alive",ip="192.168.50.50")
|
||||
|
||||
#Module Host Alive with Tag
|
||||
#We now create a modulo with tag "critical"
|
||||
|
||||
create_network_server_module(driver,"PAN_8",module_name="With tag",component_group="Network Management",network_component="Host Alive",ip="192.168.50.50",tag_name="critical")
|
||||
|
||||
l = [("Operator (Read)","All",["critical"])]
|
||||
|
||||
create_user(driver,"prueba ACL","pandora",profile_list=l)
|
||||
create_user(driver,"PAN8_user","pandora",profile_list=l)
|
||||
|
||||
logout(driver,self.base_url)
|
||||
|
||||
login(driver,user="prueba ACL")
|
||||
login(driver,user="PAN8_user")
|
||||
|
||||
detect_and_pass_all_wizards(driver)
|
||||
|
||||
#Función comprobar que existe un módulo:
|
||||
|
||||
search_agent(driver,"PAN_8")
|
||||
|
||||
try:
|
||||
|
||||
try:
|
||||
#The user should be able to see the module with Tag
|
||||
self.assertEqual("With tag" in driver.page_source,True)
|
||||
except AssertionError as e:
|
||||
self.verificationErrors.append(str(e))
|
||||
|
||||
try:
|
||||
self.assertEqual("Without tag" in driver.page_source,False)
|
||||
except AssertionError as e:
|
||||
self.verificationErrors.append(str(e))
|
||||
#The user should NOT be able to see the module without tag
|
||||
self.assertEqual("Without tag" in driver.page_source,False)
|
||||
except AssertionError as e:
|
||||
self.verificationErrors.append(str(e))
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
|
@ -18,20 +18,19 @@ def add_user_profile(driver,user_name,profile,group,tags=[]):
|
|||
driver.find_element_by_xpath('//*[@id="table3-0-6"]/a[2]').click()
|
||||
Select(driver.find_element_by_id("assign_profile")).select_by_visible_text(profile)
|
||||
|
||||
|
||||
if group == "All":
|
||||
Select(driver.find_element_by_id("assign_group")).select_by_visible_text(group)
|
||||
else:
|
||||
#TODO This will not work when choosing a group within a group within another group
|
||||
Select(driver.find_element_by_id("assign_group")).select_by_visible_text(" "+group)
|
||||
|
||||
#driver.find_element_by_id("image-add2").click()
|
||||
for tag in tags:
|
||||
Select(driver.find_element_by_id("assign_tags")).select_by_visible_text(tag)
|
||||
|
||||
for tag in tags:
|
||||
Select(driver.find_element_by_id("assign_tags")).select_by_visible_text(tag)
|
||||
|
||||
#If we do not provide tags, we NEED to leave "Any" selected, otherwise we need to deselect it.
|
||||
if tags != []:
|
||||
Select(driver.find_element_by_id("assign_tags")).deselect_by_visible_text("Any")
|
||||
#If we do not provide tags, we NEED to leave "Any" selected, otherwise we need to deselect it.
|
||||
if tags != []:
|
||||
Select(driver.find_element_by_id("assign_tags")).deselect_by_visible_text("Any")
|
||||
|
||||
driver.find_element_by_xpath('//*[@name="add"]').click()
|
||||
|
||||
|
|
Loading…
Reference in New Issue