forked from DefectDojo/django-DefectDojo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
search_test.py
114 lines (95 loc) · 4.87 KB
/
search_test.py
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
import unittest
import sys
from base_test_class import BaseTestCase
class SearchTests(BaseTestCase):
def test_login(self):
driver = self.driver
def test_search(self):
# very basic search test to see if it doesn't 500
driver = self.goto_some_page()
driver.find_element_by_id("simple_search").clear()
driver.find_element_by_id("simple_search").send_keys('finding')
driver.find_element_by_id("simple_search_submit").click()
def test_search_cve(self):
# very basic search test to see if it doesn't 500
driver = self.goto_some_page()
driver.find_element_by_id("simple_search").clear()
driver.find_element_by_id("simple_search").send_keys('cve:CVE-2020-12345')
driver.find_element_by_id("simple_search_submit").click()
driver.find_element_by_id("simple_search").clear()
driver.find_element_by_id("simple_search").send_keys('CVE-2020-12345')
driver.find_element_by_id("simple_search_submit").click()
def test_search_tag(self):
# very basic search test to see if it doesn't 500
driver = self.goto_some_page()
driver.find_element_by_id("simple_search").clear()
driver.find_element_by_id("simple_search").send_keys('tag:magento')
driver.find_element_by_id("simple_search_submit").click()
def test_search_product_tag(self):
# very basic search test to see if it doesn't 500
driver = self.goto_some_page()
driver.find_element_by_id("simple_search").clear()
driver.find_element_by_id("simple_search").send_keys('product-tag:java')
driver.find_element_by_id("simple_search_submit").click()
def test_search_engagement_tag(self):
# very basic search test to see if it doesn't 500
driver = self.goto_some_page()
driver.find_element_by_id("simple_search").clear()
driver.find_element_by_id("simple_search").send_keys('engagement-tag:php')
driver.find_element_by_id("simple_search_submit").click()
def test_search_test_tag(self):
# very basic search test to see if it doesn't 500
driver = self.goto_some_page()
driver.find_element_by_id("simple_search").clear()
driver.find_element_by_id("simple_search").send_keys('test-tag:go')
driver.find_element_by_id("simple_search_submit").click()
def test_search_tags(self):
# very basic search test to see if it doesn't 500
driver = self.goto_some_page()
driver.find_element_by_id("simple_search").clear()
driver.find_element_by_id("simple_search").send_keys('tags:php')
driver.find_element_by_id("simple_search_submit").click()
def test_search_product_tags(self):
# very basic search test to see if it doesn't 500
driver = self.goto_some_page()
driver.find_element_by_id("simple_search").clear()
driver.find_element_by_id("simple_search").send_keys('product-tags:java')
driver.find_element_by_id("simple_search_submit").click()
def test_search_engagement_tags(self):
# very basic search test to see if it doesn't 500
driver = self.goto_some_page()
driver.find_element_by_id("simple_search").clear()
driver.find_element_by_id("simple_search").send_keys('engagement-tags:php')
driver.find_element_by_id("simple_search_submit").click()
def test_search_test_tags(self):
# very basic search test to see if it doesn't 500
driver = self.goto_some_page()
driver.find_element_by_id("simple_search").clear()
driver.find_element_by_id("simple_search").send_keys('test-tags:go')
driver.find_element_by_id("simple_search_submit").click()
def test_search_id(self):
# very basic search test to see if it doesn't 500
driver = self.goto_some_page()
driver.find_element_by_id("simple_search").clear()
driver.find_element_by_id("simple_search").send_keys('id:1')
driver.find_element_by_id("simple_search_submit").click()
def suite():
suite = unittest.TestSuite()
suite.addTest(BaseTestCase('test_login'))
suite.addTest(SearchTests('test_search'))
suite.addTest(SearchTests('test_search_cve'))
suite.addTest(SearchTests('test_search_tag'))
suite.addTest(SearchTests('test_search_product_tag'))
suite.addTest(SearchTests('test_search_engagement_tag'))
suite.addTest(SearchTests('test_search_test_tag'))
suite.addTest(SearchTests('test_search_tags'))
suite.addTest(SearchTests('test_search_product_tags'))
suite.addTest(SearchTests('test_search_engagement_tags'))
suite.addTest(SearchTests('test_search_test_tags'))
suite.addTest(SearchTests('test_search_id'))
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)