From 6460639f91c67ec9c7466bbcc516587cd4a28d59 Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Wed, 31 Aug 2022 00:53:18 +0530 Subject: [PATCH] UT: Use `simplify=True` when converting configuration to dict --- .../common/agent_configuration/test_agent_configuration.py | 6 +++--- .../monkey_island/cc/resources/test_agent_configuration.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/monkey/tests/unit_tests/common/agent_configuration/test_agent_configuration.py b/monkey/tests/unit_tests/common/agent_configuration/test_agent_configuration.py index cd7344b2a..72ac501c7 100644 --- a/monkey/tests/unit_tests/common/agent_configuration/test_agent_configuration.py +++ b/monkey/tests/unit_tests/common/agent_configuration/test_agent_configuration.py @@ -207,7 +207,7 @@ def test_exploiter_configuration_schema(): def test_exploitation_configuration(): config = ExploitationConfiguration(**EXPLOITATION_CONFIGURATION) - config_dict = config.dict() + config_dict = config.dict(simplify=True) assert isinstance(config, ExploitationConfiguration) assert config_dict == convert_all_lists_to_tuples_in_mapping(EXPLOITATION_CONFIGURATION.copy()) @@ -215,7 +215,7 @@ def test_exploitation_configuration(): def test_propagation_configuration(): config = PropagationConfiguration(**PROPAGATION_CONFIGURATION) - config_dict = config.dict() + config_dict = config.dict(simplify=True) assert isinstance(config, PropagationConfiguration) assert isinstance(config.network_scan, NetworkScanConfiguration) @@ -234,7 +234,7 @@ def test_propagation_configuration__invalid_maximum_depth(): def test_agent_configuration(): config = AgentConfiguration(**AGENT_CONFIGURATION) - config_dict = config.dict() + config_dict = config.dict(simplify=True) assert isinstance(config, AgentConfiguration) assert config.keep_tunnel_open_time == 30 diff --git a/monkey/tests/unit_tests/monkey_island/cc/resources/test_agent_configuration.py b/monkey/tests/unit_tests/monkey_island/cc/resources/test_agent_configuration.py index b8c417e6d..83243c6c8 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/resources/test_agent_configuration.py +++ b/monkey/tests/unit_tests/monkey_island/cc/resources/test_agent_configuration.py @@ -26,7 +26,7 @@ def flask_client(build_flask_client): def test_agent_configuration_endpoint(flask_client): resp = flask_client.put( AGENT_CONFIGURATION_URL, - json=AgentConfiguration(**AGENT_CONFIGURATION).dict(), + json=AgentConfiguration(**AGENT_CONFIGURATION).dict(simplify=True), follow_redirects=True, ) assert resp.status_code == 200