From 7864f48e3c1d4f6f28bb0dffcddd70c2a3be00af Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Mon, 9 May 2022 07:39:05 -0400 Subject: [PATCH] Common: Make AWSInstance.is_instance() return boolean --- monkey/common/aws/aws_instance.py | 2 +- monkey/tests/unit_tests/common/aws/test_aws_instance.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/monkey/common/aws/aws_instance.py b/monkey/common/aws/aws_instance.py index 5746a93e3..76c3cac9a 100644 --- a/monkey/common/aws/aws_instance.py +++ b/monkey/common/aws/aws_instance.py @@ -30,7 +30,7 @@ class AWSInstance: @property def is_instance(self) -> bool: self._wait_for_initialization_to_complete() - return self._instance_id + return bool(self._instance_id) @property def instance_id(self) -> str: diff --git a/monkey/tests/unit_tests/common/aws/test_aws_instance.py b/monkey/tests/unit_tests/common/aws/test_aws_instance.py index 7cd785991..3ba3329f4 100644 --- a/monkey/tests/unit_tests/common/aws/test_aws_instance.py +++ b/monkey/tests/unit_tests/common/aws/test_aws_instance.py @@ -26,21 +26,21 @@ def patch_fetch_metadata_default_values(patch_fetch_metadata): def test_is_instance__true(): aws_instance = AWSInstance() - assert aws_instance.is_instance + assert aws_instance.is_instance is True def test_is_instance__false_none(patch_fetch_metadata): patch_fetch_metadata(None, "", "") aws_instance = AWSInstance() - assert not aws_instance.is_instance + assert aws_instance.is_instance is False def test_is_instance__false_empty_str(patch_fetch_metadata): patch_fetch_metadata("", "", "") aws_instance = AWSInstance() - assert not aws_instance.is_instance + assert aws_instance.is_instance is False def test_instance_id():