Add log file in ACL.py and Alerts.py
This commit is contained in:
parent
9b02510599
commit
38a8eeb437
|
@ -13,6 +13,7 @@ from selenium.common.exceptions import NoSuchElementException
|
|||
from selenium.common.exceptions import NoAlertPresentException
|
||||
from selenium.webdriver.remote.webelement import WebElement
|
||||
import unittest2, time, re
|
||||
import logging
|
||||
|
||||
class ACLPropagation(PandoraWebDriverTestCase):
|
||||
|
||||
|
@ -26,6 +27,9 @@ class ACLPropagation(PandoraWebDriverTestCase):
|
|||
ACL Propagation test: Creates one group "A" with ACL propagation, then a group "B" son of "A" with no ACL propagation, and finally group "C".
|
||||
The test asserts if a user with privileges to "A" can see the agent of "B" but no agents of "C".
|
||||
"""
|
||||
|
||||
logging.basicConfig(filename="ACL.log", level=logging.INFO, filemode='w')
|
||||
|
||||
group_name_A = gen_random_string(6)
|
||||
group_name_B = gen_random_string(6)
|
||||
group_name_C = gen_random_string(6)
|
||||
|
@ -70,6 +74,8 @@ class ACLPropagation(PandoraWebDriverTestCase):
|
|||
element = driver.find_elements_by_xpath('//a[contains(.,"'+agent_name_B+'")]')
|
||||
self.assertEqual(element,[])
|
||||
|
||||
logging.info("test_ACL_propagation is correct")
|
||||
|
||||
class ACLReports(PandoraWebDriverTestCase):
|
||||
|
||||
test_name = u'ACL reports'
|
||||
|
@ -124,6 +130,8 @@ class ACLReports(PandoraWebDriverTestCase):
|
|||
element = driver.find_element_by_xpath('//td[contains(.,"No data found.")]')
|
||||
self.assertIsInstance(element,WebElement)
|
||||
|
||||
logging.info("test_ACL_reports is correct")
|
||||
|
||||
class ACLTags(PandoraWebDriverTestCase):
|
||||
|
||||
test_name = u'ACL tag test'
|
||||
|
@ -176,5 +184,7 @@ class ACLTags(PandoraWebDriverTestCase):
|
|||
#modules = driver.find_elements_by_xpath('//td[contains(.,"'+module_name_A+'")]')
|
||||
#self.assertEqual(modules,[])
|
||||
|
||||
#logging.info("test_ACL_tag is correct")
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest2.main()
|
||||
|
|
|
@ -10,6 +10,7 @@ from selenium.common.exceptions import StaleElementReferenceException, NoSuchEle
|
|||
from selenium.common.exceptions import NoAlertPresentException
|
||||
from selenium.webdriver.remote.webelement import WebElement
|
||||
import unittest2, time, re
|
||||
import logging
|
||||
|
||||
class Alerts (PandoraWebDriverTestCase):
|
||||
|
||||
|
@ -22,6 +23,8 @@ class Alerts (PandoraWebDriverTestCase):
|
|||
Create a new alert action using eMail command and check that create ok
|
||||
"""
|
||||
|
||||
logging.basicConfig(filename="Alerts.log", level=logging.INFO, filemode='w')
|
||||
|
||||
action_name = gen_random_string(6)
|
||||
|
||||
driver = self.driver
|
||||
|
@ -38,6 +41,8 @@ class Alerts (PandoraWebDriverTestCase):
|
|||
element = driver.find_element_by_xpath('//a[contains(.,"'+action_name+'")]')
|
||||
self.assertIsInstance(element,WebElement)
|
||||
|
||||
logging.info("test_A_create_new_email_action is correct")
|
||||
|
||||
def test_B_create_new_action_command(self):
|
||||
|
||||
u"""
|
||||
|
@ -67,6 +72,8 @@ class Alerts (PandoraWebDriverTestCase):
|
|||
element = driver.find_element_by_xpath('//a[contains(.,"'+action_name+'")]')
|
||||
self.assertIsInstance(element,WebElement)
|
||||
|
||||
logging.info("test_B_create_new_action_command")
|
||||
|
||||
def test_C_create_new_template(self):
|
||||
|
||||
u"""
|
||||
|
@ -93,6 +100,8 @@ class Alerts (PandoraWebDriverTestCase):
|
|||
element = driver.find_element_by_xpath('//a[contains(.,"'+template_name+'")]')
|
||||
self.assertIsInstance(element,WebElement)
|
||||
|
||||
logging.info("test_C_create_new_template is correct")
|
||||
|
||||
def test_D_edit_template_created(self):
|
||||
|
||||
u"""
|
||||
|
@ -138,6 +147,8 @@ class Alerts (PandoraWebDriverTestCase):
|
|||
|
||||
self.assertEqual("_agentdescription_" in driver.page_source,True)
|
||||
|
||||
logging.info("test_D_edit_template_created is correct")
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest2.main()
|
||||
|
||||
|
|
Loading…
Reference in New Issue