forked from DefectDojo/django-DefectDojo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfinding_group_test.py
More file actions
66 lines (54 loc) · 2.43 KB
/
finding_group_test.py
File metadata and controls
66 lines (54 loc) · 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import sys
import unittest
from base_test_class import BaseTestCase, on_exception_html_source_logger
from selenium.webdriver.common.by import By
class FindingGroupTest(BaseTestCase):
@on_exception_html_source_logger
def test_finding_group_all_loads(self):
driver = self.driver
driver.get(self.base_url + "finding_group/all")
body_text = driver.find_element(By.TAG_NAME, "body").text
self.assertIsNotNone(body_text)
@on_exception_html_source_logger
def test_finding_group_open_loads(self):
driver = self.driver
driver.get(self.base_url + "finding_group/open")
body_text = driver.find_element(By.TAG_NAME, "body").text
self.assertIsNotNone(body_text)
@on_exception_html_source_logger
def test_finding_group_closed_loads(self):
driver = self.driver
driver.get(self.base_url + "finding_group/closed")
body_text = driver.find_element(By.TAG_NAME, "body").text
self.assertIsNotNone(body_text)
@on_exception_html_source_logger
def test_view_finding_group(self):
driver = self.driver
driver.get(self.base_url + "finding_group/all")
# Try to click on a finding group if one exists
links = driver.find_elements(By.CSS_SELECTOR, "table tbody tr td a")
if len(links) > 0:
links[0].click()
body_text = driver.find_element(By.TAG_NAME, "body").text
self.assertIsNotNone(body_text)
@on_exception_html_source_logger
def test_finding_group_filtered(self):
driver = self.driver
driver.get(self.base_url + "finding_group/open")
# Verify filtering works - just loading with open status is a filter
body_text = driver.find_element(By.TAG_NAME, "body").text
self.assertIsNotNone(body_text)
def suite():
suite = unittest.TestSuite()
suite.addTest(BaseTestCase("test_login"))
suite.addTest(FindingGroupTest("test_finding_group_all_loads"))
suite.addTest(FindingGroupTest("test_finding_group_open_loads"))
suite.addTest(FindingGroupTest("test_finding_group_closed_loads"))
suite.addTest(FindingGroupTest("test_view_finding_group"))
suite.addTest(FindingGroupTest("test_finding_group_filtered"))
return suite
if __name__ == "__main__":
runner = unittest.TextTestRunner(descriptions=True, failfast=True, verbosity=2)
ret = not runner.run(suite()).wasSuccessful()
BaseTestCase.tearDownDriver()
sys.exit(ret)