From 28461bd607cc94f50990f106dc2bf3c5db45dc99 Mon Sep 17 00:00:00 2001 From: Shreya Date: Mon, 19 Jul 2021 17:20:31 +0530 Subject: [PATCH] tests: Monkeypath `ConfigService.update_config_on_mode_set` for POST test in `test_island_mode.py` --- .../monkey_island/cc/resources/test_island_mode.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/monkey/tests/unit_tests/monkey_island/cc/resources/test_island_mode.py b/monkey/tests/unit_tests/monkey_island/cc/resources/test_island_mode.py index 823f9dad5..dc1899e8c 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/resources/test_island_mode.py +++ b/monkey/tests/unit_tests/monkey_island/cc/resources/test_island_mode.py @@ -13,7 +13,11 @@ def uses_database(): @pytest.mark.parametrize("mode", ["ransomware", "advanced"]) -def test_island_mode_post(flask_client, mode): +def test_island_mode_post(flask_client, mode, monkeypatch): + monkeypatch.setattr( + "monkey_island.cc.services.mode.set_island_mode_service.ConfigService.update_config_on_mode_set", # noqa: E501 + lambda _: None, + ) resp = flask_client.post( "/api/island-mode", data=json.dumps({"mode": mode}), follow_redirects=True )