Files
kube-hunter/tests/modules/test_reports.py
Yehuda Chikvashvili 0f1739262f Linting Standards (#330)
Fix linting issues with flake8 and black.
Add pre-commit congifuration, update documnetation for it.
Apply linting check in Travis CI.
2020-04-05 05:22:24 +03:00

34 lines
833 B
Python

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