From 25591f42e8a1d0feed4138ef2bf1c1b345bb6b2d Mon Sep 17 00:00:00 2001 From: VitthalMagadum Date: Mon, 12 Aug 2024 09:55:08 -0400 Subject: [PATCH] issue_768 Handling review comments: remove redundant check --- anta/tests/security.py | 12 ++++-------- tests/units/anta_tests/test_security.py | 7 ------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/anta/tests/security.py b/anta/tests/security.py index 59062274f..ae5b9bebd 100644 --- a/anta/tests/security.py +++ b/anta/tests/security.py @@ -840,21 +840,17 @@ class VerifyHardwareEntropy(AntaTest): """ name = "VerifyHardwareEntropy" - description = "Verifies hardware entropy generation." + description = "Verifies hardware entropy generation is enabled on device." categories: ClassVar[list[str]] = ["security"] commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show management security")] @AntaTest.anta_test def test(self) -> None: """Main test function for VerifyHardwareEntropy.""" - self.result.is_success() - command_output = self.instance_commands[0].json_output - # Check if security parameters are configured - if not command_output: - self.result.is_failure("No cryptographic algorithm is configured.") - return - + # Check if hardware entropy generation is enabled. if not command_output.get("hardwareEntropyEnabled"): self.result.is_failure("Hardware entropy generation is disabled.") + else: + self.result.is_success() diff --git a/tests/units/anta_tests/test_security.py b/tests/units/anta_tests/test_security.py index e53edd562..eabc40bd8 100644 --- a/tests/units/anta_tests/test_security.py +++ b/tests/units/anta_tests/test_security.py @@ -1228,11 +1228,4 @@ "inputs": {}, "expected": {"result": "failure", "messages": ["Hardware entropy generation is disabled."]}, }, - { - "name": "failure-not-found", - "test": VerifyHardwareEntropy, - "eos_data": [{}], - "inputs": {}, - "expected": {"result": "failure", "messages": ["No cryptographic algorithm is configured."]}, - }, ]