Skip to content

Commit

Permalink
Test that both pkg_gpgcheck and gpgcheck point to the same OptionBool
Browse files Browse the repository at this point in the history
  • Loading branch information
kontura committed Oct 16, 2024
1 parent e24754b commit 9bef3ed
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/libdnf5/conf/test_conf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,14 @@ void ConfTest::test_config_repo() {
std::vector<std::string> baseurl = {"http://example.com/value123", "http://example.com/456"};
CPPUNIT_ASSERT_EQUAL(baseurl, config_repo.get_baseurl_option().get_value());
}

void ConfTest::test_config_pkg_gpgcheck() {
// Ensure both pkg_gpgcheck and gpgcheck point to the same underlying OptionBool object

// For ConfigMain
CPPUNIT_ASSERT_EQUAL(&config.get_pkg_gpgcheck_option(), &config.get_gpgcheck_option());

// For ConfigRepo
repo::ConfigRepo config_repo(config, "test-repo");
CPPUNIT_ASSERT_EQUAL(&config_repo.get_pkg_gpgcheck_option(), &config_repo.get_gpgcheck_option());
}
2 changes: 2 additions & 0 deletions test/libdnf5/conf/test_conf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,15 @@ class ConfTest : public TestCaseFixture {
CPPUNIT_TEST_SUITE(ConfTest);
CPPUNIT_TEST(test_config_main);
CPPUNIT_TEST(test_config_repo);
CPPUNIT_TEST(test_config_pkg_gpgcheck);
CPPUNIT_TEST_SUITE_END();

public:
void setUp() override;

void test_config_main();
void test_config_repo();
void test_config_pkg_gpgcheck();

std::unique_ptr<libdnf5::Base> base;
libdnf5::LogRouter logger;
Expand Down

0 comments on commit 9bef3ed

Please sign in to comment.