mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 16:55:05 +02:00
Add create log file in Services.py Policies.py Views.py and User.py tests files
This commit is contained in:
parent
59bd635b3a
commit
2ccb1685a4
@ -11,7 +11,9 @@ from selenium.webdriver.support.ui import Select
|
|||||||
from selenium.common.exceptions import NoSuchElementException
|
from selenium.common.exceptions import NoSuchElementException
|
||||||
from selenium.common.exceptions import NoAlertPresentException
|
from selenium.common.exceptions import NoAlertPresentException
|
||||||
from selenium.webdriver.remote.webelement import WebElement
|
from selenium.webdriver.remote.webelement import WebElement
|
||||||
|
|
||||||
import unittest2, time, re
|
import unittest2, time, re
|
||||||
|
import logging
|
||||||
|
|
||||||
class Policies(PandoraWebDriverTestCase):
|
class Policies(PandoraWebDriverTestCase):
|
||||||
|
|
||||||
@ -22,6 +24,7 @@ class Policies(PandoraWebDriverTestCase):
|
|||||||
policy_name = gen_random_string(6)
|
policy_name = gen_random_string(6)
|
||||||
network_server_module_name = gen_random_string(6)
|
network_server_module_name = gen_random_string(6)
|
||||||
|
|
||||||
|
logging.basicConfig(filename="Policies.log", level=logging.INFO, filemode='w')
|
||||||
|
|
||||||
@is_enterprise
|
@is_enterprise
|
||||||
def test_A_create_policy(self):
|
def test_A_create_policy(self):
|
||||||
@ -40,7 +43,8 @@ class Policies(PandoraWebDriverTestCase):
|
|||||||
element = driver.find_element_by_xpath('//a[contains(.,"'+self.policy_name+'")]')
|
element = driver.find_element_by_xpath('//a[contains(.,"'+self.policy_name+'")]')
|
||||||
self.assertIsInstance(element,WebElement)
|
self.assertIsInstance(element,WebElement)
|
||||||
|
|
||||||
|
logging.info("test_A_create_policy is correct")
|
||||||
|
|
||||||
@is_enterprise
|
@is_enterprise
|
||||||
def test_B_add_network_server_module_to_policy(self):
|
def test_B_add_network_server_module_to_policy(self):
|
||||||
|
|
||||||
@ -54,7 +58,8 @@ class Policies(PandoraWebDriverTestCase):
|
|||||||
element = driver.find_element_by_xpath('//td[contains(.,"uccessfully")]')
|
element = driver.find_element_by_xpath('//td[contains(.,"uccessfully")]')
|
||||||
self.assertIsInstance(element,WebElement)
|
self.assertIsInstance(element,WebElement)
|
||||||
|
|
||||||
|
logging.info("test_B_add_network_server_module_to_policy is correct")
|
||||||
|
|
||||||
@is_enterprise
|
@is_enterprise
|
||||||
def test_C_add_collection_to_policy(self):
|
def test_C_add_collection_to_policy(self):
|
||||||
|
|
||||||
@ -77,7 +82,7 @@ class Policies(PandoraWebDriverTestCase):
|
|||||||
element = driver.find_element_by_xpath('//td[contains(.,"Correct: add the collection in the policy")]')
|
element = driver.find_element_by_xpath('//td[contains(.,"Correct: add the collection in the policy")]')
|
||||||
self.assertIsInstance(element,WebElement)
|
self.assertIsInstance(element,WebElement)
|
||||||
|
|
||||||
|
logging.info("test_C_add_collection_to_policy is correct")
|
||||||
|
|
||||||
@is_enterprise
|
@is_enterprise
|
||||||
def test_D_Apply_policy_to_agents(self):
|
def test_D_Apply_policy_to_agents(self):
|
||||||
@ -128,6 +133,8 @@ class Policies(PandoraWebDriverTestCase):
|
|||||||
module = driver.find_element_by_xpath('//td[contains(.,"'+module_name_2+'")]')
|
module = driver.find_element_by_xpath('//td[contains(.,"'+module_name_2+'")]')
|
||||||
self.assertIsInstance(module,WebElement)
|
self.assertIsInstance(module,WebElement)
|
||||||
|
|
||||||
|
logging.info("test_D_Apply_policy_to_agents is correct")
|
||||||
|
|
||||||
@is_enterprise
|
@is_enterprise
|
||||||
def test_E_Apply_policy_to_agents_with_spaces(self):
|
def test_E_Apply_policy_to_agents_with_spaces(self):
|
||||||
|
|
||||||
@ -181,6 +188,7 @@ class Policies(PandoraWebDriverTestCase):
|
|||||||
module = driver.find_element_by_xpath('//td[contains(.,"'+module_name+'")]')
|
module = driver.find_element_by_xpath('//td[contains(.,"'+module_name+'")]')
|
||||||
self.assertIsInstance(module,WebElement)
|
self.assertIsInstance(module,WebElement)
|
||||||
|
|
||||||
|
logging.info("test_E_Apply_policy_to_agents_with_spaces is correct")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest2.main()
|
unittest2.main()
|
||||||
|
@ -15,6 +15,7 @@ from selenium.common.exceptions import NoAlertPresentException
|
|||||||
from selenium.webdriver.remote.webelement import WebElement
|
from selenium.webdriver.remote.webelement import WebElement
|
||||||
|
|
||||||
import unittest2, time, re
|
import unittest2, time, re
|
||||||
|
import logging
|
||||||
|
|
||||||
class SimpleService(PandoraWebDriverTestCase):
|
class SimpleService(PandoraWebDriverTestCase):
|
||||||
|
|
||||||
@ -31,6 +32,7 @@ class SimpleService(PandoraWebDriverTestCase):
|
|||||||
module_normal_2_name = gen_random_string(6)
|
module_normal_2_name = gen_random_string(6)
|
||||||
module_warning_1_name = gen_random_string(6)
|
module_warning_1_name = gen_random_string(6)
|
||||||
|
|
||||||
|
logging.basicConfig(filename="Service.log", level=logging.INFO, filemode='w')
|
||||||
|
|
||||||
@is_enterprise
|
@is_enterprise
|
||||||
def test_A_simple_service(self):
|
def test_A_simple_service(self):
|
||||||
@ -106,6 +108,8 @@ class SimpleService(PandoraWebDriverTestCase):
|
|||||||
element = driver.find_element_by_xpath('//td/img[@data-title="Warning"]')
|
element = driver.find_element_by_xpath('//td/img[@data-title="Warning"]')
|
||||||
self.assertIsInstance(element,WebElement)
|
self.assertIsInstance(element,WebElement)
|
||||||
|
|
||||||
|
logging.info("test_A_simple_service is correct")
|
||||||
|
|
||||||
@is_enterprise
|
@is_enterprise
|
||||||
def test_B_simple_service(self):
|
def test_B_simple_service(self):
|
||||||
|
|
||||||
@ -136,6 +140,8 @@ class SimpleService(PandoraWebDriverTestCase):
|
|||||||
element = driver.find_element_by_xpath('//td/img[@data-title="Critical"]')
|
element = driver.find_element_by_xpath('//td/img[@data-title="Critical"]')
|
||||||
self.assertIsInstance(element,WebElement)
|
self.assertIsInstance(element,WebElement)
|
||||||
|
|
||||||
|
logging.info("test_B_simple_service is correct")
|
||||||
|
|
||||||
@is_enterprise
|
@is_enterprise
|
||||||
def test_C_simple_service(self):
|
def test_C_simple_service(self):
|
||||||
|
|
||||||
@ -166,7 +172,8 @@ class SimpleService(PandoraWebDriverTestCase):
|
|||||||
element = driver.find_element_by_xpath('//td/img[@data-title="Ok"]')
|
element = driver.find_element_by_xpath('//td/img[@data-title="Ok"]')
|
||||||
self.assertIsInstance(element,WebElement)
|
self.assertIsInstance(element,WebElement)
|
||||||
|
|
||||||
|
logging.info("test_C_simple_service is correct")
|
||||||
|
|
||||||
class ManualService(PandoraWebDriverTestCase):
|
class ManualService(PandoraWebDriverTestCase):
|
||||||
|
|
||||||
test_name = u'Auto service tests'
|
test_name = u'Auto service tests'
|
||||||
@ -224,6 +231,9 @@ class ManualService(PandoraWebDriverTestCase):
|
|||||||
|
|
||||||
element = driver.find_element_by_xpath('//td/img[@data-title="Ok"]')
|
element = driver.find_element_by_xpath('//td/img[@data-title="Ok"]')
|
||||||
self.assertIsInstance(element,WebElement)
|
self.assertIsInstance(element,WebElement)
|
||||||
|
|
||||||
|
logging.info("test_A_manual_service_ok is correct")
|
||||||
|
|
||||||
|
|
||||||
@is_enterprise
|
@is_enterprise
|
||||||
def test_B_auto_service_critical(self):
|
def test_B_auto_service_critical(self):
|
||||||
@ -249,6 +259,8 @@ class ManualService(PandoraWebDriverTestCase):
|
|||||||
element = driver.find_element_by_xpath('//td/img[@data-title="Critical"]')
|
element = driver.find_element_by_xpath('//td/img[@data-title="Critical"]')
|
||||||
self.assertIsInstance(element,WebElement)
|
self.assertIsInstance(element,WebElement)
|
||||||
|
|
||||||
|
logging.info("test_B_auto_service_critical is correct")
|
||||||
|
|
||||||
@is_enterprise
|
@is_enterprise
|
||||||
def test_C_auto_service_warning(self):
|
def test_C_auto_service_warning(self):
|
||||||
|
|
||||||
@ -273,6 +285,8 @@ class ManualService(PandoraWebDriverTestCase):
|
|||||||
element = driver.find_element_by_xpath('//td/img[@data-title="Warning"]')
|
element = driver.find_element_by_xpath('//td/img[@data-title="Warning"]')
|
||||||
self.assertIsInstance(element,WebElement)
|
self.assertIsInstance(element,WebElement)
|
||||||
|
|
||||||
|
logging.info("test_C_auto_service_warning is correct")
|
||||||
|
|
||||||
class serviceInsideService(PandoraWebDriverTestCase):
|
class serviceInsideService(PandoraWebDriverTestCase):
|
||||||
|
|
||||||
test_name = u'Auto service tests'
|
test_name = u'Auto service tests'
|
||||||
@ -341,6 +355,8 @@ class serviceInsideService(PandoraWebDriverTestCase):
|
|||||||
element = driver.find_element_by_xpath('//td/img[@data-title="Ok"]')
|
element = driver.find_element_by_xpath('//td/img[@data-title="Ok"]')
|
||||||
self.assertIsInstance(element,WebElement)
|
self.assertIsInstance(element,WebElement)
|
||||||
|
|
||||||
|
logging.info("test_A_service_ok is correct")
|
||||||
|
|
||||||
@is_enterprise
|
@is_enterprise
|
||||||
def test_B_service_critical(self):
|
def test_B_service_critical(self):
|
||||||
|
|
||||||
@ -372,6 +388,8 @@ class serviceInsideService(PandoraWebDriverTestCase):
|
|||||||
element = driver.find_element_by_xpath('//td/img[@data-title="Critical"]')
|
element = driver.find_element_by_xpath('//td/img[@data-title="Critical"]')
|
||||||
self.assertIsInstance(element,WebElement)
|
self.assertIsInstance(element,WebElement)
|
||||||
|
|
||||||
|
logging.info("test_B_service_critical is correct")
|
||||||
|
|
||||||
@is_enterprise
|
@is_enterprise
|
||||||
def test_C_service_warning(self):
|
def test_C_service_warning(self):
|
||||||
|
|
||||||
@ -404,6 +422,6 @@ class serviceInsideService(PandoraWebDriverTestCase):
|
|||||||
element = driver.find_element_by_xpath('//td/img[@data-title="Critical"]')
|
element = driver.find_element_by_xpath('//td/img[@data-title="Critical"]')
|
||||||
self.assertIsInstance(element,WebElement)
|
self.assertIsInstance(element,WebElement)
|
||||||
|
|
||||||
|
logging.info("test_C_service_warning is correct")
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest2.main()
|
unittest2.main()
|
||||||
|
@ -10,6 +10,7 @@ from selenium.common.exceptions import NoAlertPresentException
|
|||||||
from selenium.webdriver.remote.webelement import WebElement
|
from selenium.webdriver.remote.webelement import WebElement
|
||||||
|
|
||||||
import unittest2, time, re
|
import unittest2, time, re
|
||||||
|
import logging
|
||||||
|
|
||||||
class Users(PandoraWebDriverTestCase):
|
class Users(PandoraWebDriverTestCase):
|
||||||
|
|
||||||
@ -23,6 +24,8 @@ class Users(PandoraWebDriverTestCase):
|
|||||||
Modify home screen, and check that change is correct. Return this change
|
Modify home screen, and check that change is correct. Return this change
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
logging.basicConfig(filename="Users.log", level=logging.INFO, filemode='w')
|
||||||
|
|
||||||
driver = self.driver
|
driver = self.driver
|
||||||
self.login()
|
self.login()
|
||||||
detect_and_pass_all_wizards(driver)
|
detect_and_pass_all_wizards(driver)
|
||||||
@ -39,7 +42,8 @@ class Users(PandoraWebDriverTestCase):
|
|||||||
|
|
||||||
activate_home_screen(driver,"Default")
|
activate_home_screen(driver,"Default")
|
||||||
|
|
||||||
|
logging.info("test_A_home_screen is correct")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest2.main()
|
unittest2.main()
|
||||||
|
|
||||||
|
@ -8,7 +8,9 @@ from selenium.webdriver.support.ui import Select
|
|||||||
from selenium.common.exceptions import NoSuchElementException
|
from selenium.common.exceptions import NoSuchElementException
|
||||||
from selenium.common.exceptions import NoAlertPresentException
|
from selenium.common.exceptions import NoAlertPresentException
|
||||||
from selenium.webdriver.remote.webelement import WebElement
|
from selenium.webdriver.remote.webelement import WebElement
|
||||||
|
|
||||||
import unittest2, time, re
|
import unittest2, time, re
|
||||||
|
import logging
|
||||||
|
|
||||||
class viewAppear(PandoraWebDriverTestCase):
|
class viewAppear(PandoraWebDriverTestCase):
|
||||||
|
|
||||||
@ -23,6 +25,9 @@ class viewAppear(PandoraWebDriverTestCase):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
logging.basicConfig(filename="Views.log", level=logging.INFO, filemode='w')
|
||||||
|
|
||||||
driver = self.driver
|
driver = self.driver
|
||||||
self.login()
|
self.login()
|
||||||
detect_and_pass_all_wizards(driver)
|
detect_and_pass_all_wizards(driver)
|
||||||
@ -312,6 +317,8 @@ class viewAppear(PandoraWebDriverTestCase):
|
|||||||
self.assertEqual("The last version of package installed is:" in driver.page_source,True)
|
self.assertEqual("The last version of package installed is:" in driver.page_source,True)
|
||||||
click_menu_element(driver,"Update Manager options")
|
click_menu_element(driver,"Update Manager options")
|
||||||
|
|
||||||
|
logging.info("test_views_appear is correct")
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user