Skip to content

Commit

Permalink
Update assert
Browse files Browse the repository at this point in the history
Signed-off-by: Divya Madala <[email protected]>
  • Loading branch information
Divyaasm committed Sep 12, 2024
1 parent d995707 commit a9aba50
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/validation_workflow/rpm/validation_rpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def validate_signature(self) -> None:
present_key.append(key)
logging.info("Validation of all key digests starts: ")
for digest in key_list:
assert present_key.contains(digest)
assert digest in present_key
logging.info(f'Key digest "{digest}" is validated to be present.')

logging.info("Validation for signature of RPM distribution completed.")
4 changes: 2 additions & 2 deletions tests/tests_validation_workflow/test_validation_rpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,12 +326,12 @@ def test_validate_signature_except(self, mock_temporary_directory: Mock, mock_va
mock_temporary_directory.return_value.path = "/tmp/trytytyuit/"
validate_rpm.filename = 'example.rpm'

with self.assertRaises(Exception) as context:
with self.assertRaises(AssertionError) as context:
validate_rpm.validate_signature()
mock_logging_info.assert_any_call('Key digest "Header SHA256 digest" is validated to be present.')
mock_logging_info.assert_any_call('Key digest "Payload SHA256 digest" is validated to be present.')
mock_logging_info.assert_any_call('Validation of all key digests starts: ')
self.assertEqual(str(context.exception), 'Key digest "MD5 digest" is not found')
self.assertIsInstance(context.exception, AssertionError)

mock_execute.assert_called_once_with(
'rpm -K -v /tmp/trytytyuit/example.rpm', '.'
Expand Down

0 comments on commit a9aba50

Please sign in to comment.