From 6d03842c231c579ee4d79eb1cb04d595194ec31e Mon Sep 17 00:00:00 2001 From: Divya Madala Date: Thu, 12 Sep 2024 11:49:09 -0700 Subject: [PATCH] Add more changes Signed-off-by: Divya Madala --- src/validation_workflow/rpm/validation_rpm.py | 9 ++++----- tests/tests_validation_workflow/test_validation_rpm.py | 5 +++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/validation_workflow/rpm/validation_rpm.py b/src/validation_workflow/rpm/validation_rpm.py index 173e144cd7..1d3373a031 100644 --- a/src/validation_workflow/rpm/validation_rpm.py +++ b/src/validation_workflow/rpm/validation_rpm.py @@ -119,12 +119,11 @@ def validate_signature(self) -> None: key_list = ["Header V4 RSA/SHA512 Signature, key ID 9310d3fc", "Header SHA256 digest", "Header SHA1 digest", "Payload SHA256 digest", "V4 RSA/SHA512 Signature, key ID 9310d3fc", "MD5 digest"] present_key = [] - for line in stdout.rstrip('\n').split('\n'): + for line in stdout.rstrip('\n').split('\n')[1:]: key = line.split(':')[0].strip() - if key != os.path.join(self.tmp_dir.path, self.filename): - assert "OK" == line.split(':')[1].strip() - logging.info(f"{key} is validated as: {line}") - present_key.append(key) + assert "OK" == line.split(':')[1].strip() + logging.info(f"{key} is validated as: {line}") + present_key.append(key) logging.info("Validation of all key digests starts: ") for digest in key_list: assert digest in present_key diff --git a/tests/tests_validation_workflow/test_validation_rpm.py b/tests/tests_validation_workflow/test_validation_rpm.py index 0412f778c9..f07e3ab779 100644 --- a/tests/tests_validation_workflow/test_validation_rpm.py +++ b/tests/tests_validation_workflow/test_validation_rpm.py @@ -275,7 +275,7 @@ def test_validate_metadata_exception(self, mock_temporary_directory: Mock, mock_ @patch('validation_workflow.rpm.validation_rpm.ValidationArgs') @patch('system.temporary_directory.TemporaryDirectory') def test_validate_signature(self, mock_temporary_directory: Mock, mock_validation_args: Mock, mock_logging_info: Mock, mock_execute: Mock) -> None: - mock_execute.return_value = (None, 'Header V4 RSA/SHA512 Signature, key ID 9310d3fc: OK\nHeader SHA1 digest: OK\nV4 RSA/SHA512 Signature, key ID 9310d3fc: OK\n' + mock_execute.return_value = (None, '/tmp/trytytyuit/example.rpm\nHeader V4 RSA/SHA512 Signature, key ID 9310d3fc: OK\nHeader SHA1 digest: OK\nV4 RSA/SHA512 Signature, key ID 9310d3fc: OK\n' 'MD5 digest: OK\nHeader SHA256 digest: OK\nPayload SHA256 digest: OK\n', None) validate_rpm = ValidateRpm(mock_validation_args.return_value, mock_temporary_directory.return_value) @@ -297,7 +297,7 @@ def test_validate_signature(self, mock_temporary_directory: Mock, mock_validatio @patch('validation_workflow.rpm.validation_rpm.ValidationArgs') @patch('system.temporary_directory.TemporaryDirectory') def test_validate_signature_exception(self, mock_temporary_directory: Mock, mock_validation_args: Mock, mock_logging_info: Mock, mock_execute: Mock) -> None: - mock_execute.return_value = (None, 'Header V4 RSA/SHA512 Signature, key ID 9310d3fc: OK\nHeader SHA1 digest: OK\nV4 RSA/SHA512 Signature, key ID 9310d3fc: OK\n' + mock_execute.return_value = (None, '/tmp/trytytyuit/example.rpm\nHeader V4 RSA/SHA512 Signature, key ID 9310d3fc: OK\nHeader SHA1 digest: OK\nV4 RSA/SHA512 Signature, key ID 9310d3fc: OK\n' 'MD5 digest: not OK\nHeader SHA256 digest: OK\nPayload SHA256 digest: OK\n', None) validate_rpm = ValidateRpm(mock_validation_args.return_value, mock_temporary_directory.return_value) @@ -318,6 +318,7 @@ def test_validate_signature_exception(self, mock_temporary_directory: Mock, mock @patch('system.temporary_directory.TemporaryDirectory') def test_validate_signature_except(self, mock_temporary_directory: Mock, mock_validation_args: Mock, mock_logging_info: Mock, mock_execute: Mock) -> None: mock_execute.return_value = (None, + '/tmp/trytytyuit/example.rpm\n' 'Header V4 RSA/SHA512 Signature, key ID 9310d3fc: OK\nHeader SHA256 digest: OK\n' 'Header SHA1 digest: OK\nPayload SHA256 digest: OK\nV4 RSA/SHA512 Signature, key ID 9310d3fc: OK\n', None)