mirror of
https://github.com/aquasecurity/kube-hunter.git
synced 2026-03-03 02:00:45 +00:00
* added plugins submodule, created two hookspecs, one for adding arguments, one for running code after the argument parsing * implemented plugins application on main file, changed mechanism for argument parsing * changed previous parsing function to not create the ArgumentParser, and implemented it as a hook for the parsing mechanism * added pluggy to required deps * removed unecessary add_config import * fixed formatting using black * restored main link file from master * moved import of parser to right before the register call, to avoid circular imports * added tests for the plugins hooks * removed blank line space * black reformat
18 lines
537 B
Python
18 lines
537 B
Python
from argparse import ArgumentParser
|
|
from tests.plugins import test_hooks
|
|
from kube_hunter.plugins import initialize_plugin_manager
|
|
|
|
|
|
def test_all_plugin_hooks():
|
|
pm = initialize_plugin_manager()
|
|
pm.register(test_hooks)
|
|
|
|
# Testing parser_add_arguments
|
|
parser = ArgumentParser("Test Argument Parser")
|
|
results = pm.hook.parser_add_arguments(parser=parser)
|
|
assert test_hooks.return_string in results
|
|
|
|
# Testing load_plugin
|
|
results = pm.hook.load_plugin(args=[])
|
|
assert test_hooks.return_string in results
|