From 216af633ad1a4874e138ef9e1e908dcde284c915 Mon Sep 17 00:00:00 2001 From: VakarisZ Date: Wed, 17 Nov 2021 17:25:11 +0200 Subject: [PATCH] UT: fix a flaw in test_get_label_by_id unit test in test_monkey.py that incorrectly asserts the hit/miss of monkey label cache --- .../tests/unit_tests/monkey_island/cc/models/test_monkey.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/monkey/tests/unit_tests/monkey_island/cc/models/test_monkey.py b/monkey/tests/unit_tests/monkey_island/cc/models/test_monkey.py index 827a6631e..f5a00e5e7 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/models/test_monkey.py +++ b/monkey/tests/unit_tests/monkey_island/cc/models/test_monkey.py @@ -134,14 +134,14 @@ class TestMonkey: assert cache_info_after_query_2.hits == 1 assert cache_info_after_query_2.misses == 1 - # should be a miss + # should be a another hit, since the monkey ID is already cached label = Monkey.get_label_by_id(linux_monkey.id) logger.debug("3) ID: {} label: {}".format(linux_monkey.id, label)) cache_info_after_query_3 = Monkey.get_label_by_id.storage.backend.cache_info() logger.debug("Cache info: {}".format(str(cache_info_after_query_3))) # still 1 hit only - assert cache_info_after_query_3.hits == 1 - assert cache_info_after_query_3.misses == 2 + assert cache_info_after_query_3.hits == 2 + assert cache_info_after_query_3.misses == 1 @pytest.mark.usefixtures("uses_database") def test_is_monkey(self):