UT: Mark some slow tests as "slow"

This commit is contained in:
Mike Salvatore 2021-12-14 07:26:27 -05:00
parent 0b6199e7eb
commit 7b2756bab0
6 changed files with 11 additions and 0 deletions

View File

@ -178,6 +178,7 @@ def test_scan_multiple_ips(callback, scan_config, stop):
assert_scan_results(ip, scan_results)
@pytest.mark.slow
def test_scan_lots_of_ips(callback, scan_config, stop):
ips = [f"10.0.0.{i}" for i in range(0, 255)]

View File

@ -156,6 +156,7 @@ def test_get_stolen_creds_exploit(fake_mongo):
assert expected_stolen_creds_exploit == stolen_creds_exploit
@pytest.mark.slow
@pytest.mark.usefixtures("uses_database", "uses_encryptor")
def test_get_stolen_creds_system_info(fake_mongo):
fake_mongo.db.monkey.insert_one(MONKEY_TELEM)

View File

@ -85,6 +85,7 @@ def test_needs_registration__false(tmp_path):
assert not a_s.needs_registration()
@pytest.mark.slow
@pytest.mark.parametrize("error", [InvalidRegistrationCredentialsError, AlreadyRegisteredError])
def test_register_new_user__fails(
tmp_path, mock_reset_datastore_encryptor, mock_reset_database, error
@ -116,6 +117,7 @@ def test_register_new_user__empty_password_fails(
mock_reset_database.assert_not_called()
@pytest.mark.slow
def test_register_new_user(tmp_path, mock_reset_datastore_encryptor, mock_reset_database):
mock_add_user = MagicMock()
mock_user_datastore = MockUserDatastore(lambda: False, mock_add_user, None)
@ -134,6 +136,7 @@ def test_register_new_user(tmp_path, mock_reset_datastore_encryptor, mock_reset_
mock_reset_database.assert_called_once()
@pytest.mark.slow
def test_authenticate__success(tmp_path, mock_unlock_datastore_encryptor):
mock_user_datastore = MockUserDatastore(
lambda: True,
@ -149,6 +152,7 @@ def test_authenticate__success(tmp_path, mock_unlock_datastore_encryptor):
mock_unlock_datastore_encryptor.assert_called_once()
@pytest.mark.slow
@pytest.mark.parametrize(
("username", "password"), [("wrong_username", PASSWORD), (USERNAME, "wrong_password")]
)

View File

@ -11,6 +11,7 @@ def mock_port(monkeypatch, PORT):
monkeypatch.setattr("monkey_island.cc.services.config.ISLAND_PORT", PORT)
@pytest.mark.slow
@pytest.mark.usefixtures("uses_encryptor")
def test_set_server_ips_in_config_command_servers(config, IPS, PORT):
ConfigService.set_server_ips_in_config(config)
@ -18,6 +19,7 @@ def test_set_server_ips_in_config_command_servers(config, IPS, PORT):
assert config["internal"]["island_server"]["command_servers"] == expected_config_command_servers
@pytest.mark.slow
@pytest.mark.usefixtures("uses_encryptor")
def test_set_server_ips_in_config_current_server(config, IPS, PORT):
ConfigService.set_server_ips_in_config(config)

View File

@ -4,6 +4,7 @@ from monkey_island.cc.services.config_manipulator import update_config_on_mode_s
from monkey_island.cc.services.mode.mode_enum import IslandModeEnum
@pytest.mark.slow
@pytest.mark.usefixtures("uses_encryptor")
def test_update_config_on_mode_set_advanced(config, monkeypatch):
monkeypatch.setattr("monkey_island.cc.services.config.ConfigService.get_config", lambda: config)
@ -17,6 +18,7 @@ def test_update_config_on_mode_set_advanced(config, monkeypatch):
assert manipulated_config == config
@pytest.mark.slow
@pytest.mark.usefixtures("uses_encryptor")
def test_update_config_on_mode_set_ransomware(config, monkeypatch):
monkeypatch.setattr("monkey_island.cc.services.config.ConfigService.get_config", lambda: config)

View File

@ -16,6 +16,7 @@ class MockObject:
pass
@pytest.mark.slow
@pytest.mark.usefixtures("uses_database", "uses_encryptor")
def test_is_aws_keys_setup(tmp_path):
# Mock default configuration