From 351dce2110a8b04f51c77fa5400c51ed7f7e7532 Mon Sep 17 00:00:00 2001 From: Adamantios Date: Thu, 22 Aug 2024 16:08:24 +0300 Subject: [PATCH] test: update tests related to the dict overrides changes --- tests/test_cli/test_config.py | 9 +++++---- tests/test_configurations/test_base.py | 4 ++-- tests/test_configurations/test_validation.py | 7 ++++--- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/tests/test_cli/test_config.py b/tests/test_cli/test_config.py index e896557c4d..c1aa7971bb 100644 --- a/tests/test_cli/test_config.py +++ b/tests/test_cli/test_config.py @@ -462,7 +462,7 @@ def test_set_nested_attribute_not_allowed(self): assert result.exit_code == 1 assert ( result.exception.message - == "Attribute `behaviours.dummy.config.behaviour_arg_1` is not allowed to be updated!" + == "Attribute `behaviours.dummy.config` is not allowed to be updated!" ) def test_no_recognized_root(self): @@ -542,10 +542,11 @@ def test_attribute_not_found(self): catch_exceptions=False, ) - def test_set_fails_when_setting_non_primitive_type(self): + def test_incorrect_data_type(self): """Test that setting the 'dummy' skill behaviours fails because not a primitive type.""" with pytest.raises( - ClickException, match="Attribute `behaviours` is not allowed to be updated!" + ClickException, + match="For attribute `behaviours` `dict` data type is expected, but `str` was provided!", ): self.runner.invoke( cli, @@ -558,7 +559,7 @@ def test_get_fails_when_setting_nested_object(self): """Test that setting a nested object in 'dummy' skill fails because path is not valid.""" with pytest.raises( ClickException, - match=r"Attribute `non_existing_attribute.dummy` is not allowed to be updated!", + match=r"Attribute `non_existing_attribute` is not allowed to be updated!", ): self.runner.invoke( cli, diff --git a/tests/test_configurations/test_base.py b/tests/test_configurations/test_base.py index c2e3336956..27bab57e8c 100644 --- a/tests/test_configurations/test_base.py +++ b/tests/test_configurations/test_base.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # -# Copyright 2022-2023 Valory AG +# Copyright 2022-2024 Valory AG # Copyright 2018-2021 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -298,7 +298,7 @@ def test_update_method_raises_error_if_skill_component_not_allowed(self): with pytest.raises( ValueError, - match="Attribute `behaviours.new_behaviour.args` is not allowed to be updated!", + match="Attribute `behaviours.new_behaviour` is not allowed to be updated!", ): skill_config.update(new_configurations) diff --git a/tests/test_configurations/test_validation.py b/tests/test_configurations/test_validation.py index 1e19a71fab..682be8eba4 100644 --- a/tests/test_configurations/test_validation.py +++ b/tests/test_configurations/test_validation.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # -# Copyright 2022 Valory AG +# Copyright 2022-2024 Valory AG # Copyright 2018-2021 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -46,14 +46,15 @@ def test_compare_data_pattern(): assert not validate_data_with_pattern( {"a": "${var}"}, {"a": "string"}, skip_env_vars=True ) + assert not validate_data_with_pattern({"a": {}}, {"a": {"b": 12}}) errors = validate_data_with_pattern({"a": 12}, {"b": 12}) assert errors assert errors[0] == "Attribute `a` is not allowed to be updated!" - errors = validate_data_with_pattern({"a": {}}, {"a": {"b": 12}}) + errors = validate_data_with_pattern({"a": {"b": 12}}, {"a": {}}) assert errors - assert errors[0] == "Attribute `a` is not allowed to be updated!" + assert errors[0] == "Attribute `a.b` is not allowed to be updated!" def test_filter_data():