From f11e2dc8a1177d9af3013c00f8db82eb13422e7f Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Tue, 30 Aug 2022 12:43:49 +0530 Subject: [PATCH] UT: Fix configuration logic to work with pydantic in `agent_configuration` fixture --- .../monkey_island/cc/services/test_repository_service.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/monkey/tests/unit_tests/monkey_island/cc/services/test_repository_service.py b/monkey/tests/unit_tests/monkey_island/cc/services/test_repository_service.py index 202daf263..292936635 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/services/test_repository_service.py +++ b/monkey/tests/unit_tests/monkey_island/cc/services/test_repository_service.py @@ -1,4 +1,3 @@ -from dataclasses import replace from unittest.mock import MagicMock import pytest @@ -18,12 +17,10 @@ WINDOWS_FILENAME = "windows_pba_file.ps1" @pytest.fixture def agent_configuration(default_agent_configuration: AgentConfiguration) -> AgentConfiguration: - custom_pbas = replace( - default_agent_configuration.custom_pbas, - linux_filename=LINUX_FILENAME, - windows_filename=WINDOWS_FILENAME, + custom_pbas = default_agent_configuration.custom_pbas.copy( + update={"linux_filename": LINUX_FILENAME, "windows_filename": WINDOWS_FILENAME}, ) - return replace(default_agent_configuration, custom_pbas=custom_pbas) + return default_agent_configuration.copy(update={"custom_pbas": custom_pbas}) @pytest.fixture