UT: Remove Scoutsuite's unit tests

This commit is contained in:
Shreya Malviya 2022-02-03 14:05:19 +05:30
parent 894250f965
commit c2c609aa3a
1 changed files with 0 additions and 38 deletions

View File

@ -1,38 +0,0 @@
from unittest.mock import MagicMock
import dpath.util
import pytest
from common.config_value_paths import AWS_KEYS_PATH
from monkey_island.cc.database import mongo
from monkey_island.cc.server_utils.encryption import get_datastore_encryptor
from monkey_island.cc.services.config import ConfigService
from monkey_island.cc.services.zero_trust.scoutsuite.scoutsuite_auth_service import (
is_aws_keys_setup,
)
class MockObject:
pass
@pytest.mark.slow
@pytest.mark.usefixtures("uses_database", "uses_encryptor")
def test_is_aws_keys_setup(tmp_path):
# Mock default configuration
ConfigService.init_default_config()
mongo.db = MockObject()
mongo.db.config = MockObject()
ConfigService.encrypt_config(ConfigService.default_config)
mongo.db.config.find_one = MagicMock(return_value=ConfigService.default_config)
assert not is_aws_keys_setup()
bogus_key_value = get_datastore_encryptor().encrypt("bogus_aws_key")
dpath.util.set(
ConfigService.default_config, AWS_KEYS_PATH + ["aws_secret_access_key"], bogus_key_value
)
dpath.util.set(
ConfigService.default_config, AWS_KEYS_PATH + ["aws_access_key_id"], bogus_key_value
)
assert is_aws_keys_setup()