From 35c6491be0eb4010e1d9071be778f2a9ac3970e1 Mon Sep 17 00:00:00 2001 From: Pavla Kratochvilova Date: Thu, 26 Oct 2023 12:06:07 +0200 Subject: [PATCH] modules: Test `ModuleProfile::is_default()` method --- test/libdnf5/module/test_module.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/libdnf5/module/test_module.cpp b/test/libdnf5/module/test_module.cpp index 342787995..d5748f213 100644 --- a/test/libdnf5/module/test_module.cpp +++ b/test/libdnf5/module/test_module.cpp @@ -80,12 +80,22 @@ void ModuleTest::test_load() { CPPUNIT_ASSERT_EQUAL(std::string("ninja;platform:[f29,f30,f31]"), meson.get_module_dependencies_string()); CPPUNIT_ASSERT_EQUAL((size_t)1, meson.get_profiles().size()); CPPUNIT_ASSERT_EQUAL(std::string("default"), meson.get_profiles()[0].get_name()); + CPPUNIT_ASSERT_EQUAL(false, meson.get_profiles()[0].is_default()); CPPUNIT_ASSERT_EQUAL(std::string(""), module_sack->get_default_stream("meson")); CPPUNIT_ASSERT_EQUAL(std::string("main"), module_sack->get_default_stream("berries")); CPPUNIT_ASSERT_EQUAL((size_t)0, module_sack->get_default_profiles("meson", "master").size()); CPPUNIT_ASSERT_EQUAL((size_t)1, module_sack->get_default_profiles("berries", "main").size()); CPPUNIT_ASSERT_EQUAL(std::string("minimal"), module_sack->get_default_profiles("berries", "main")[0]); + + ModuleQuery query_berries = ModuleQuery(base, false); + query_berries.filter_name("berries"); + query_berries.filter_stream("main"); + for (const auto & berries : query_berries.list()) { + for (const auto & berries_profile : berries.get_profiles()) { + CPPUNIT_ASSERT_EQUAL(true, berries_profile.is_default()); + } + } }