forked from p15670423/monkey
Common: Set AWSInstance.is_instance to False if empty string
This commit is contained in:
parent
09218ef3d3
commit
ca38235b8e
|
@ -34,7 +34,7 @@ class AWSInstance:
|
|||
@property
|
||||
def is_instance(self) -> bool:
|
||||
self._wait_for_initialization_to_complete()
|
||||
return self._instance_id is not None
|
||||
return self._instance_id
|
||||
|
||||
@property
|
||||
def instance_id(self) -> str:
|
||||
|
|
|
@ -29,13 +29,20 @@ def test_is_instance__true():
|
|||
assert aws_instance.is_instance
|
||||
|
||||
|
||||
def test_is_instance__false(patch_fetch_metadata):
|
||||
def test_is_instance__false_none(patch_fetch_metadata):
|
||||
patch_fetch_metadata(None, "", "")
|
||||
aws_instance = AWSInstance()
|
||||
|
||||
assert not aws_instance.is_instance
|
||||
|
||||
|
||||
def test_is_instance__false_empty_str(patch_fetch_metadata):
|
||||
patch_fetch_metadata("", "", "")
|
||||
aws_instance = AWSInstance()
|
||||
|
||||
assert not aws_instance.is_instance
|
||||
|
||||
|
||||
def test_instance_id():
|
||||
aws_instance = AWSInstance()
|
||||
|
||||
|
|
Loading…
Reference in New Issue