mirror of
https://github.com/aquasecurity/kube-hunter.git
synced 2026-05-14 21:27:14 +00:00
* Make config initialized explicitly * Add mypy linting * Make tests run individually Resolve #341
39 lines
925 B
Python
39 lines
925 B
Python
# flake8: noqa: E402
|
|
from kube_hunter.conf import Config, set_config
|
|
|
|
set_config(Config())
|
|
|
|
from kube_hunter.modules.report import get_reporter, get_dispatcher
|
|
from kube_hunter.modules.report.factory import (
|
|
YAMLReporter,
|
|
JSONReporter,
|
|
PlainReporter,
|
|
HTTPDispatcher,
|
|
STDOUTDispatcher,
|
|
)
|
|
|
|
|
|
def test_reporters():
|
|
test_cases = [
|
|
("plain", PlainReporter),
|
|
("json", JSONReporter),
|
|
("yaml", YAMLReporter),
|
|
("notexists", PlainReporter),
|
|
]
|
|
|
|
for report_type, expected in test_cases:
|
|
actual = get_reporter(report_type)
|
|
assert type(actual) is expected
|
|
|
|
|
|
def test_dispatchers():
|
|
test_cases = [
|
|
("stdout", STDOUTDispatcher),
|
|
("http", HTTPDispatcher),
|
|
("notexists", STDOUTDispatcher),
|
|
]
|
|
|
|
for dispatcher_type, expected in test_cases:
|
|
actual = get_dispatcher(dispatcher_type)
|
|
assert type(actual) is expected
|