mirror of
https://github.com/kiwix/libkiwix.git
synced 2025-06-26 10:11:30 +00:00
Dropped Library::getBookBy*() non-const functions
This commit is contained in:
@ -232,7 +232,7 @@ class LibraryTest : public ::testing::Test {
|
||||
void SetUp() override {
|
||||
kiwix::Manager manager(&lib);
|
||||
manager.readOpds(sampleOpdsStream, "foo.urlHost");
|
||||
manager.readXml(sampleLibraryXML, true, "./test/library.xml", true);
|
||||
manager.readXml(sampleLibraryXML, false, "./test/library.xml", true);
|
||||
}
|
||||
|
||||
kiwix::Bookmark createBookmark(const std::string &id) {
|
||||
@ -660,13 +660,14 @@ TEST_F(LibraryTest, filterByMultipleCriteria)
|
||||
|
||||
TEST_F(LibraryTest, getBookByPath)
|
||||
{
|
||||
auto& book = lib.getBookById(lib.getBooksIds()[0]);
|
||||
kiwix::Book book = lib.getBookById(lib.getBooksIds()[0]);
|
||||
#ifdef _WIN32
|
||||
auto path = "C:\\some\\abs\\path.zim";
|
||||
#else
|
||||
auto path = "/some/abs/path.zim";
|
||||
#endif
|
||||
book.setPath(path);
|
||||
lib.addBook(book);
|
||||
EXPECT_EQ(lib.getBookByPath(path).getId(), book.getId());
|
||||
EXPECT_THROW(lib.getBookByPath("non/existant/path.zim"), std::out_of_range);
|
||||
}
|
||||
|
@ -21,9 +21,11 @@ class NameMapperTest : public ::testing::Test {
|
||||
protected:
|
||||
void SetUp() override {
|
||||
kiwix::Manager manager(&lib);
|
||||
manager.readXml(libraryXML, true, "./library.xml", true);
|
||||
manager.readXml(libraryXML, false, "./library.xml", true);
|
||||
for ( const std::string& id : lib.getBooksIds() ) {
|
||||
lib.getBookById(id).setPathValid(true);
|
||||
kiwix::Book bookCopy = lib.getBookById(id);
|
||||
bookCopy.setPathValid(true);
|
||||
lib.addBook(bookCopy);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user