Add readOnly parameter to Manager::readOpds()

This commit is contained in:
Hamazasp Avetisyan committed 2026-08-29 21:32:26 +04:00
1 parent a855af4849
commit fe9efe84ec
3 files changed
+33 -13

No files matched your search

+14
View File
@@ -246,6 +246,20 @@ const char sampleOpdsFeed[] = R"(
</feed>
)";
TEST(ManagerTest, readOpdsHonorsReadOnlyTrue)
{
// readOpds() defaults to readOnly=false (see
// ManagerTest.readOpdsAddsEntriesAndParsesSearchMetadata below, which
// covers that case) - this checks that readOnly=true is honored too.
auto lib = kiwix::Library::create();
kiwix::Manager manager(lib);
EXPECT_TRUE(manager.readOpds(sampleOpdsFeed, "http://example.com", /*readOnly=*/true));
EXPECT_TRUE(lib->getBookById("book1").readOnly());
EXPECT_TRUE(lib->getBookById("book2").readOnly());
}
TEST(ManagerTest, readOpdsAddsEntriesAndParsesSearchMetadata)
{
auto lib = kiwix::Library::create();