UT: Fix formatting of test_island_mode.py

This commit is contained in:
Mike Salvatore 2022-06-30 15:07:53 -04:00
parent 9ece3c100b
commit 6206196eda
1 changed files with 8 additions and 3 deletions

View File

@ -4,9 +4,9 @@ import pytest
from tests.utils import raise_
from monkey_island.cc.models.island_mode_model import IslandMode
from monkey_island.cc.services.mode.mode_enum import IslandModeEnum
from monkey_island.cc.resources import island_mode as island_mode_resource
from monkey_island.cc.resources.island_mode import IslandMode as IslandModeResource
from monkey_island.cc.services.mode.mode_enum import IslandModeEnum
@pytest.fixture(scope="function")
@ -14,7 +14,10 @@ def uses_database():
IslandMode.objects().delete()
@pytest.mark.parametrize("mode", [IslandModeEnum.RANSOMWARE.value, IslandModeEnum.ADVANCED.value, IslandModeEnum.UNSET.value])
@pytest.mark.parametrize(
"mode",
[IslandModeEnum.RANSOMWARE.value, IslandModeEnum.ADVANCED.value, IslandModeEnum.UNSET.value],
)
def test_island_mode_post(flask_client, mode, monkeypatch):
monkeypatch.setattr(
"monkey_island.cc.resources.island_mode.update_config_on_mode_set",
@ -43,7 +46,9 @@ def test_island_mode_post__internal_server_error(monkeypatch, flask_client):
monkeypatch.setattr(island_mode_resource, "set_mode", lambda x: raise_(Exception()))
resp = flask_client.post(
IslandModeResource.urls[0], data=json.dumps({"mode":IslandModeEnum.RANSOMWARE.value}), follow_redirects=True
IslandModeResource.urls[0],
data=json.dumps({"mode": IslandModeEnum.RANSOMWARE.value}),
follow_redirects=True,
)
assert resp.status_code == 500