Tests: Mark slow tests with @pytest.mark.slow
This allows you to skip slow tests by running `pytest -m 'not slow'`.
This commit is contained in:
parent
f0033d0c7c
commit
ac52c308f3
|
@ -13,6 +13,7 @@ def test_is_config_encrypted__json(monkey_config_json):
|
||||||
assert not ConfigurationImport.is_config_encrypted(monkey_config_json)
|
assert not ConfigurationImport.is_config_encrypted(monkey_config_json)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.slow
|
||||||
def test_is_config_encrypted__ciphertext(monkey_config_json):
|
def test_is_config_encrypted__ciphertext(monkey_config_json):
|
||||||
encrypted_config = encrypt_string(monkey_config_json, PASSWORD)
|
encrypted_config = encrypt_string(monkey_config_json, PASSWORD)
|
||||||
assert ConfigurationImport.is_config_encrypted(encrypted_config)
|
assert ConfigurationImport.is_config_encrypted(encrypted_config)
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
|
import pytest
|
||||||
|
|
||||||
from monkey_island.cc.services.attack.mitre_api_interface import MitreApiInterface
|
from monkey_island.cc.services.attack.mitre_api_interface import MitreApiInterface
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.slow
|
||||||
def test_get_all_mitigations():
|
def test_get_all_mitigations():
|
||||||
mitigations = MitreApiInterface.get_all_mitigations()
|
mitigations = MitreApiInterface.get_all_mitigations()
|
||||||
assert len(mitigations.items()) >= 282
|
assert len(mitigations.items()) >= 282
|
||||||
|
|
|
@ -16,21 +16,25 @@ PASSWORD = "hello123"
|
||||||
INCORRECT_PASSWORD = "goodbye321"
|
INCORRECT_PASSWORD = "goodbye321"
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.slow
|
||||||
def test_encrypt_decrypt_string(monkey_config_json):
|
def test_encrypt_decrypt_string(monkey_config_json):
|
||||||
encrypted_config = encrypt_string(monkey_config_json, PASSWORD)
|
encrypted_config = encrypt_string(monkey_config_json, PASSWORD)
|
||||||
assert decrypt_ciphertext(encrypted_config, PASSWORD) == monkey_config_json
|
assert decrypt_ciphertext(encrypted_config, PASSWORD) == monkey_config_json
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.slow
|
||||||
def test_decrypt_string__wrong_password(monkey_config_json):
|
def test_decrypt_string__wrong_password(monkey_config_json):
|
||||||
with pytest.raises(InvalidCredentialsError):
|
with pytest.raises(InvalidCredentialsError):
|
||||||
decrypt_ciphertext(VALID_CIPHER_TEXT, INCORRECT_PASSWORD)
|
decrypt_ciphertext(VALID_CIPHER_TEXT, INCORRECT_PASSWORD)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.slow
|
||||||
def test_decrypt_string__malformed_corrupted():
|
def test_decrypt_string__malformed_corrupted():
|
||||||
with pytest.raises(ValueError):
|
with pytest.raises(ValueError):
|
||||||
decrypt_ciphertext(MALFORMED_CIPHER_TEXT_CORRUPTED, PASSWORD)
|
decrypt_ciphertext(MALFORMED_CIPHER_TEXT_CORRUPTED, PASSWORD)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.slow
|
||||||
def test_decrypt_string__no_password(monkey_config_json):
|
def test_decrypt_string__no_password(monkey_config_json):
|
||||||
with pytest.raises(InvalidCredentialsError):
|
with pytest.raises(InvalidCredentialsError):
|
||||||
decrypt_ciphertext(VALID_CIPHER_TEXT, "")
|
decrypt_ciphertext(VALID_CIPHER_TEXT, "")
|
||||||
|
|
|
@ -21,6 +21,7 @@ log_cli_format = "%(asctime)s [%(levelname)s] %(module)s.%(funcName)s.%(lineno)d
|
||||||
log_cli_date_format = "%H:%M:%S"
|
log_cli_date_format = "%H:%M:%S"
|
||||||
addopts = "-v --capture=sys tests/unit_tests"
|
addopts = "-v --capture=sys tests/unit_tests"
|
||||||
norecursedirs = "node_modules dist"
|
norecursedirs = "node_modules dist"
|
||||||
|
markers = ["slow: mark test as slow"]
|
||||||
|
|
||||||
[tool.vulture]
|
[tool.vulture]
|
||||||
exclude = ["monkey/monkey_island/cc/ui/", "monkey/tests/"]
|
exclude = ["monkey/monkey_island/cc/ui/", "monkey/tests/"]
|
||||||
|
|
Loading…
Reference in New Issue