Skip to content

Commit 5149a8b

Browse files
committed
Fixed python tests
1 parent b9df4e5 commit 5149a8b

15 files changed

Lines changed: 19 additions & 18 deletions

scripts/python/lib/test_helper.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def setup(self, plugin_id, prefix):
2121
def teardown(self):
2222
pass
2323

24-
def run_test(self):
24+
def run_test(self, cases = None):
2525
result = TestResult('run_test')
2626
result.add_message(False, 'TODO add implementation')
2727
return result
@@ -68,7 +68,7 @@ def __init__(self, plugin_id = 0, plugin_alias = '', script_alias = ''):
6868
def set_show_ok(self):
6969
self.show_all = True
7070

71-
def add_case(self, cases):
71+
def add_case(self, cases : List[str]):
7272
self.cases.extend(cases)
7373

7474
def add(self, suites : List[BasicTest]):
@@ -80,7 +80,8 @@ def run(self):
8080
for suite in self.suites:
8181
suite.setup(self.plugin_id, self.prefix)
8282
suite_result = TestResult('Running suite: %s'%suite.title())
83-
suite_result.append(suite.run_test())
83+
cases = self.cases if self.cases else None
84+
suite_result.append(suite.run_test(cases))
8485
result.append(suite_result)
8586
result.add_message(suite_result.is_ok(), 'Result from suite: %s'%suite.title())
8687
suite.teardown()

scripts/python/test_eventlog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def test_syntax(self, filter, syntax, expected):
132132
result.assert_equals(msg, expected, "Validate message rendering syntax: %s"%msg)
133133
return result
134134

135-
def run_test(self):
135+
def run_test(self, cases = None):
136136
result = TestResult('Checking CheckEventLog')
137137
cache = TestResult('Checking CheckEventLog CACHE')
138138

scripts/python/test_external_script.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def do_one_test(self, script, expected = status.OK, message = "Foo Bar", args=[]
6161
log_error(l)
6262
return result
6363

64-
def run_test(self):
64+
def run_test(self, cases = None):
6565
ret = TestResult('External scripts test suite')
6666
result = TestResult('Arguments NOT allowed')
6767
result.add(self.do_one_test('tes_script_ok', message='OK: Everything is going to be fine'))

scripts/python/test_log_file.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def run_boundry_test(self):
120120

121121
return result
122122

123-
def run_test(self):
123+
def run_test(self, cases = None):
124124
result = TestResult('Test')
125125
result.append(self.run_filter_operator_test())
126126
result.append(self.run_boundry_test())

scripts/python/test_nrpe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ def do_one_test(self, ssl=True, length=1024):
228228
result.add(self.test_one(ssl, length, state = status.CRITICAL, tag = 'crit'))
229229
return result
230230

231-
def run_test(self, cases=None):
231+
def run_test(self, cases = None):
232232
result = TestResult()
233233
result.add(self.do_one_test(ssl=True))
234234
result.add(self.do_one_test(ssl=False))

scripts/python/test_nsca.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ def test_one_crypto(self, crypto, length=512):
292292
result.add(self.test_one_crypto_full(crypto, status.CRITICAL, 'crit', target, length))
293293
return result
294294

295-
def run_test(self, cases=None):
295+
def run_test(self, cases = None):
296296
result = TestResult()
297297
cryptos = ["none", "xor", "des", "3des", "cast128", "xtea", "blowfish", "twofish", "rc2", "aes", "aes256", "aes192", "aes128", "serpent", "gost", "3way"]
298298
for c in cryptos:

scripts/python/test_nscp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def do_one_test(self, ssl=True):
219219
#result.add(self.test_one(ssl, length, state = status.CRITICAL, tag = 'crit'))
220220
return result
221221

222-
def run_test(self):
222+
def run_test(self, cases = None):
223223
result = TestResult()
224224
result.add(self.do_one_test(ssl=False))
225225
#result.add(self.do_one_test(ssl=True))

scripts/python/test_pb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def test_simple(self, command, code, message, perf, tag):
8888
return result
8989

9090

91-
def run_test(self):
91+
def run_test(self, cases = None):
9292
result = TestResult()
9393
result.add(self.test_simple('foobar', status.OK, 'qwerty', '', 'simple ok'))
9494
result.add(self.test_simple('foobar', status.WARNING, 'foobar', '', 'simple warning'))

scripts/python/test_python.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def teardown(self):
4848
self.core.reload('test_scheduler')
4949
None
5050

51-
def run_test(self):
51+
def run_test(self, cases = None):
5252
result = TestResult()
5353
start = time()
5454
total_count = install_checks*time_to_run/5

scripts/python/test_scheduler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def check_one(self, result, key, min, max):
6060
result.assert_gt(self.command_count[key], min, 'check %s (%d) fired more then %d'%(key, self.command_count[key], min))
6161
result.assert_lt(self.command_count[key], max, 'check %s (%d) fired less then %d'%(key, self.command_count[key], max))
6262

63-
def run_test(self):
63+
def run_test(self, cases = None):
6464
self.core.load_module('Scheduler', self.sched_alias)
6565
result = TestResult()
6666
start = time()

0 commit comments

Comments
 (0)