forked from p34709852/monkey
Merge pull request #1190 from guardicore/vulture-skip-unit-tests
Configure Vulture to skip tests/unit_tests/
This commit is contained in:
commit
e6bb48100e
2
.flake8
2
.flake8
|
@ -1,7 +1,7 @@
|
|||
[flake8]
|
||||
## Warn about linter issues.
|
||||
|
||||
exclude = monkey/monkey_island/cc/ui,whitelist.py
|
||||
exclude = monkey/monkey_island/cc/ui,vulture_allowlist.py
|
||||
show-source = True
|
||||
max-complexity = 10
|
||||
max-line-length = 100
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
from infection_monkey.utils.plugins.pluginTests.PluginTestClass import PluginTester # noqa: F401
|
||||
|
||||
|
||||
class SomeDummyPlugin:
|
||||
pass
|
|
@ -1,5 +0,0 @@
|
|||
from infection_monkey.utils.plugins.pluginTests.PluginTestClass import PluginTester
|
||||
|
||||
|
||||
class PluginWorking(PluginTester):
|
||||
pass
|
|
@ -0,0 +1,7 @@
|
|||
from tests.unit_tests.infection_monkey.utils.plugins.pluginTests.PluginTestClass import ( # noqa: F401, E501
|
||||
PluginTester,
|
||||
)
|
||||
|
||||
|
||||
class SomeDummyPlugin:
|
||||
pass
|
|
@ -1,4 +1,4 @@
|
|||
from infection_monkey.utils.plugins.pluginTests.PluginTestClass import PluginTester
|
||||
from tests.unit_tests.infection_monkey.utils.plugins.pluginTests.PluginTestClass import PluginTester
|
||||
|
||||
|
||||
class BadPluginInit(PluginTester):
|
|
@ -1,4 +1,4 @@
|
|||
from infection_monkey.utils.plugins.pluginTests.PluginTestClass import PluginTester
|
||||
from tests.unit_tests.infection_monkey.utils.plugins.pluginTests.PluginTestClass import PluginTester
|
||||
|
||||
|
||||
class BadInit(PluginTester):
|
|
@ -1,4 +1,5 @@
|
|||
import infection_monkey.utils.plugins.pluginTests
|
||||
import tests.unit_tests.infection_monkey.utils.plugins.pluginTests
|
||||
|
||||
from infection_monkey.utils.plugins.plugin import Plugin
|
||||
|
||||
|
||||
|
@ -15,8 +16,8 @@ class PluginTester(Plugin):
|
|||
|
||||
@staticmethod
|
||||
def base_package_file():
|
||||
return infection_monkey.utils.plugins.pluginTests.__file__
|
||||
return tests.unit_tests.infection_monkey.utils.plugins.pluginTests.__file__
|
||||
|
||||
@staticmethod
|
||||
def base_package_name():
|
||||
return infection_monkey.utils.plugins.pluginTests.__package__
|
||||
return tests.unit_tests.infection_monkey.utils.plugins.pluginTests.__package__
|
|
@ -0,0 +1,5 @@
|
|||
from tests.unit_tests.infection_monkey.utils.plugins.pluginTests.PluginTestClass import PluginTester
|
||||
|
||||
|
||||
class PluginWorking(PluginTester):
|
||||
pass
|
|
@ -1,10 +1,13 @@
|
|||
from unittest import TestCase
|
||||
|
||||
from infection_monkey.utils.plugins.pluginTests.BadImport import SomeDummyPlugin
|
||||
from infection_monkey.utils.plugins.pluginTests.BadInit import BadPluginInit
|
||||
from infection_monkey.utils.plugins.pluginTests.ComboFile import BadInit, ProperClass
|
||||
from infection_monkey.utils.plugins.pluginTests.PluginTestClass import PluginTester
|
||||
from infection_monkey.utils.plugins.pluginTests.PluginWorking import PluginWorking
|
||||
from tests.unit_tests.infection_monkey.utils.plugins.pluginTests.BadImport import SomeDummyPlugin
|
||||
from tests.unit_tests.infection_monkey.utils.plugins.pluginTests.BadInit import BadPluginInit
|
||||
from tests.unit_tests.infection_monkey.utils.plugins.pluginTests.ComboFile import (
|
||||
BadInit,
|
||||
ProperClass,
|
||||
)
|
||||
from tests.unit_tests.infection_monkey.utils.plugins.pluginTests.PluginTestClass import PluginTester
|
||||
from tests.unit_tests.infection_monkey.utils.plugins.pluginTests.PluginWorking import PluginWorking
|
||||
|
||||
|
||||
class TestPlugin(TestCase):
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
import pytest
|
||||
from mongoengine import ValidationError
|
||||
from tests.unit_tests.monkey_island.cc.services.zero_trust.test_common.scoutsuite_finding_data import ( # noqa: E501
|
||||
RULES,
|
||||
)
|
||||
|
||||
import common.common_consts.zero_trust_consts as zero_trust_consts
|
||||
from monkey_island.cc.models.zero_trust.finding import Finding
|
||||
from monkey_island.cc.models.zero_trust.monkey_finding_details import MonkeyFindingDetails
|
||||
from monkey_island.cc.models.zero_trust.scoutsuite_finding import ScoutSuiteFinding
|
||||
from monkey_island.cc.models.zero_trust.scoutsuite_finding_details import ScoutSuiteFindingDetails
|
||||
from monkey_island.cc.services.zero_trust.test_common.scoutsuite_finding_data import RULES
|
||||
|
||||
MONKEY_FINDING_DETAIL_MOCK = MonkeyFindingDetails()
|
||||
MONKEY_FINDING_DETAIL_MOCK.events = ["mock1", "mock2"]
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
from enum import Enum
|
||||
|
||||
import pytest
|
||||
from tests.unit_tests.monkey_island.cc.services.zero_trust.raw_scoutsute_data import (
|
||||
RAW_SCOUTSUITE_DATA,
|
||||
)
|
||||
|
||||
from common.utils.exceptions import RulePathCreatorNotFound
|
||||
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_names.ec2_rules import EC2Rules
|
||||
from monkey_island.cc.services.zero_trust.scoutsuite.consts.service_consts import SERVICES
|
||||
from monkey_island.cc.services.zero_trust.scoutsuite.data_parsing.rule_parser import RuleParser
|
||||
from monkey_island.cc.services.zero_trust.test_common.raw_scoutsute_data import RAW_SCOUTSUITE_DATA
|
||||
|
||||
|
||||
class ExampleRules(Enum):
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
from copy import deepcopy
|
||||
|
||||
from tests.unit_tests.monkey_island.cc.services.zero_trust.test_common.scoutsuite_finding_data import ( # noqa: E501
|
||||
RULES,
|
||||
)
|
||||
|
||||
from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_consts import (
|
||||
RULE_LEVEL_DANGER,
|
||||
RULE_LEVEL_WARNING,
|
||||
|
@ -7,7 +11,6 @@ from monkey_island.cc.services.zero_trust.scoutsuite.consts.rule_consts import (
|
|||
from monkey_island.cc.services.zero_trust.scoutsuite.scoutsuite_rule_service import (
|
||||
ScoutSuiteRuleService,
|
||||
)
|
||||
from monkey_island.cc.services.zero_trust.test_common.scoutsuite_finding_data import RULES
|
||||
|
||||
example_scoutsuite_data = {
|
||||
"checked_items": 179,
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import pytest
|
||||
from tests.unit_tests.monkey_island.cc.services.zero_trust.test_common.scoutsuite_finding_data import ( # noqa: E501
|
||||
RULES,
|
||||
SCOUTSUITE_FINDINGS,
|
||||
)
|
||||
|
||||
from monkey_island.cc.models.zero_trust.finding import Finding
|
||||
from monkey_island.cc.models.zero_trust.scoutsuite_finding import ScoutSuiteFinding
|
||||
from monkey_island.cc.services.zero_trust.scoutsuite.scoutsuite_zt_finding_service import (
|
||||
ScoutSuiteZTFindingService,
|
||||
)
|
||||
from monkey_island.cc.services.zero_trust.test_common.scoutsuite_finding_data import (
|
||||
RULES,
|
||||
SCOUTSUITE_FINDINGS,
|
||||
)
|
||||
|
||||
|
||||
class TestScoutSuiteZTFindingService:
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
from common.common_consts import zero_trust_consts
|
||||
from monkey_island.cc.services.zero_trust.test_common.finding_data import (
|
||||
from tests.unit_tests.monkey_island.cc.services.zero_trust.test_common.finding_data import (
|
||||
get_monkey_finding_dto,
|
||||
get_scoutsuite_finding_dto,
|
||||
)
|
||||
|
||||
from common.common_consts import zero_trust_consts
|
||||
|
||||
|
||||
def save_example_findings():
|
||||
# devices passed = 1
|
|
@ -1,3 +1,10 @@
|
|||
from tests.unit_tests.monkey_island.cc.services.zero_trust.test_common.monkey_finding_data import (
|
||||
get_monkey_details_dto,
|
||||
)
|
||||
from tests.unit_tests.monkey_island.cc.services.zero_trust.test_common.scoutsuite_finding_data import ( # noqa: E501
|
||||
get_scoutsuite_details_dto,
|
||||
)
|
||||
|
||||
from common.common_consts.zero_trust_consts import (
|
||||
STATUS_FAILED,
|
||||
STATUS_PASSED,
|
||||
|
@ -7,12 +14,6 @@ from common.common_consts.zero_trust_consts import (
|
|||
from monkey_island.cc.models.zero_trust.finding import Finding
|
||||
from monkey_island.cc.models.zero_trust.monkey_finding import MonkeyFinding
|
||||
from monkey_island.cc.models.zero_trust.scoutsuite_finding import ScoutSuiteFinding
|
||||
from monkey_island.cc.services.zero_trust.test_common.monkey_finding_data import (
|
||||
get_monkey_details_dto,
|
||||
)
|
||||
from monkey_island.cc.services.zero_trust.test_common.scoutsuite_finding_data import (
|
||||
get_scoutsuite_details_dto,
|
||||
)
|
||||
|
||||
|
||||
def get_scoutsuite_finding_dto() -> Finding:
|
|
@ -1,6 +1,10 @@
|
|||
from unittest.mock import MagicMock
|
||||
|
||||
import pytest
|
||||
from tests.unit_tests.monkey_island.cc.services.zero_trust.test_common.finding_data import (
|
||||
get_monkey_finding_dto,
|
||||
get_scoutsuite_finding_dto,
|
||||
)
|
||||
|
||||
from common.common_consts.zero_trust_consts import (
|
||||
DEVICES,
|
||||
|
@ -14,10 +18,6 @@ from common.common_consts.zero_trust_consts import (
|
|||
from monkey_island.cc.services.zero_trust.monkey_findings.monkey_zt_details_service import (
|
||||
MonkeyZTDetailsService,
|
||||
)
|
||||
from monkey_island.cc.services.zero_trust.test_common.finding_data import (
|
||||
get_monkey_finding_dto,
|
||||
get_scoutsuite_finding_dto,
|
||||
)
|
||||
from monkey_island.cc.services.zero_trust.zero_trust_report.finding_service import (
|
||||
EnrichedFinding,
|
||||
FindingService,
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
from typing import List
|
||||
|
||||
import pytest
|
||||
from tests.unit_tests.monkey_island.cc.services.zero_trust.test_common.example_finding_data import ( # noqa: E501
|
||||
save_example_findings,
|
||||
)
|
||||
|
||||
from common.common_consts import zero_trust_consts
|
||||
from common.common_consts.zero_trust_consts import (
|
||||
|
@ -13,9 +16,6 @@ from common.common_consts.zero_trust_consts import (
|
|||
WORKLOADS,
|
||||
)
|
||||
from monkey_island.cc.services.zero_trust.zero_trust_report.pillar_service import PillarService
|
||||
from monkey_island.cc.services.zero_trust.zero_trust_report.test_common.example_finding_data import ( # noqa: E501
|
||||
save_example_findings,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("uses_database")
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import pytest
|
||||
|
||||
from common.common_consts import zero_trust_consts
|
||||
from monkey_island.cc.services.zero_trust.test_common.finding_data import (
|
||||
from tests.unit_tests.monkey_island.cc.services.zero_trust.test_common.finding_data import (
|
||||
get_monkey_finding_dto,
|
||||
get_scoutsuite_finding_dto,
|
||||
)
|
||||
|
||||
from common.common_consts import zero_trust_consts
|
||||
from monkey_island.cc.services.zero_trust.zero_trust_report.principle_service import (
|
||||
PrincipleService,
|
||||
)
|
||||
|
|
|
@ -23,5 +23,5 @@ addopts = "-v --capture=sys tests"
|
|||
norecursedirs = "node_modules dist"
|
||||
|
||||
[tool.vulture]
|
||||
exclude = ["monkey/monkey_island/cc/ui"]
|
||||
exclude = ["monkey/monkey_island/cc/ui/", "monkey/tests/"]
|
||||
paths = ["."]
|
||||
|
|
|
@ -167,6 +167,8 @@ DigitalOcean # unused variable (monkey/common/cloud/environment_names.py:12)
|
|||
_.aws_info # unused attribute (monkey/monkey_island/cc/environment/aws.py:13)
|
||||
build_from_config_file_contents # unused method 'build_from_config_file_contents' (\monkey_island\setup\island_config_options.py:18)
|
||||
mock_port_in_env_singleton # monkey\tests\unit_tests\monkey_island\cc\services\test_config.py:26:
|
||||
ISLAND # unused variable (monkey/monkey_island/cc/services/utils/node_states.py:14)
|
||||
MONKEY_LINUX_RUNNING # unused variable (monkey/monkey_island/cc/services/utils/node_states.py:26)
|
||||
|
||||
# these are not needed for it to work, but may be useful extra information to understand what's going on
|
||||
WINDOWS_PBA_TYPE # unused variable (monkey/monkey_island/cc/resources/pba_file_upload.py:23)
|
||||
|
@ -182,7 +184,11 @@ thread_id # unused variable (monkey/infection_monkey/network/mysqlfinger.py:61)
|
|||
_.get_wmi_info # unused method (monkey/infection_monkey/system_info/windows_info_collector.py:63)
|
||||
|
||||
|
||||
# not 100% sure about these? are these being/will be used somewhere else?
|
||||
# potentially unused (there may also be unit tests referencing these)
|
||||
LOG_DIR_NAME # unused variable (envs/monkey_zoo/blackbox/log_handlers/test_logs_handler.py:8)
|
||||
delete_logs # unused function (envs/monkey_zoo/blackbox/test_blackbox.py:85)
|
||||
MongoQueryJSONEncoder # unused class (envs/monkey_zoo/blackbox/utils/json_encoder.py:6)
|
||||
environment # unused variable (monkey/monkey_island/cc/models/monkey.py:59)
|
||||
_.environment # unused attribute (monkey/monkey_island/cc/services/telemetry/processing/system_info_collectors/environment.py:10)
|
||||
_.instance_name # unused attribute (monkey/common/cloud/azure/azure_instance.py:35)
|
||||
_.instance_name # unused attribute (monkey/common/cloud/azure/azure_instance.py:64)
|
Loading…
Reference in New Issue