Skip to content

Commit

Permalink
gpgcheck: fix unit tests after adding warning and SKIPPED
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-goode committed Jul 24, 2023
1 parent 0b8eba0 commit a1a0331
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion test/libdnf5/base/test_transaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ void BaseTransactionTest::test_check_gpg_signatures_no_gpgcheck() {

CPPUNIT_ASSERT_EQUAL((size_t)1, transaction.get_transaction_packages_count());
CPPUNIT_ASSERT(transaction.check_gpg_signatures());
CPPUNIT_ASSERT(transaction.get_gpg_signature_problems().empty());
CPPUNIT_ASSERT_EQUAL((size_t)1, transaction.get_gpg_signature_problems().size());
CPPUNIT_ASSERT_EQUAL(
std::string("Warning: skipped PGP checks for 1 package(s)."), transaction.get_gpg_signature_problems()[0]);
}

void BaseTransactionTest::test_check_gpg_signatures_fail() {
Expand Down
3 changes: 2 additions & 1 deletion test/python3/libdnf5/base/test_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ def test_check_gpg_signatures_no_gpgcheck(self):

self.assertEqual(1, transaction.get_transaction_packages_count())
self.assertTrue(transaction.check_gpg_signatures())
self.assertEqual((), transaction.get_gpg_signature_problems())
self.assertEqual(('Warning: skipped PGP checks for 1 package(s).',),
transaction.get_gpg_signature_problems())

def test_check_gpg_signatures_fail(self):
self.base.get_config().gpgcheck = True
Expand Down
2 changes: 1 addition & 1 deletion test/python3/libdnf5/rpm/test_rpm_signature.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_checking_signature(self):

rpm_sign = libdnf5.rpm.RpmSignature(self.base)
result = rpm_sign.check_package_signature(package)
self.assertEqual(result, libdnf5.rpm.RpmSignature.CheckResult_OK)
self.assertEqual(result, libdnf5.rpm.RpmSignature.CheckResult_SKIPPED)

def test_key_files_vector_wrapper(self):
# Test wrapper for std::vector<KeyInfo>
Expand Down

0 comments on commit a1a0331

Please sign in to comment.