Skip to content

Commit

Permalink
issue_768 Handling review comments: remove redundant check
Browse files Browse the repository at this point in the history
  • Loading branch information
VitthalMagadum committed Aug 12, 2024
1 parent 18f1c6b commit 25591f4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
12 changes: 4 additions & 8 deletions anta/tests/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
7 changes: 0 additions & 7 deletions tests/units/anta_tests/test_security.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."]},
},
]

0 comments on commit 25591f4

Please sign in to comment.