void AnimenfoFetcherTest::testGhost() { KConfig config(QFINDTESTDATA("tellicotest.config"), KConfig::SimpleConfig); QString groupName = QLatin1String("AnimeNfo.com"); if(!config.hasGroup(groupName)) { QSKIP("This test requires a config file.", SkipAll); } KConfigGroup cg(&config, groupName); Tellico::Fetch::FetchRequest request(Tellico::Data::Collection::Book, Tellico::Fetch::Keyword, "Ghost in the Shell"); Tellico::Fetch::Fetcher::Ptr fetcher(new Tellico::Fetch::AnimeNfoFetcher(this)); fetcher->readConfig(cg, cg.name()); Tellico::Data::EntryList results = DO_FETCH(fetcher, request); QCOMPARE(results.size(), 1); // the first entry had better be the right one Tellico::Data::EntryPtr entry = results.at(0); QVERIFY(entry); QCOMPARE(entry->field("title"), QLatin1String("Kokaku Kido Tai")); QCOMPARE(entry->field("pub_year"), QLatin1String("1991")); QCOMPARE(entry->field("genre"), QLatin1String("Action; Science-Fiction")); QCOMPARE(entry->field("publisher"), QLatin1String("Kodansha")); QCOMPARE(entry->field("origtitle"), QString::fromUtf8("攻殻機動隊")); QCOMPARE(entry->field("author"), QString::fromUtf8("Shiro Masamune (士郎 正宗)")); QCOMPARE(entry->field("alttitle"), QLatin1String("Ghost in the Shell")); QVERIFY(!entry->field("cover").isEmpty()); QVERIFY(!entry->field("animenfo").isEmpty()); }
void GoogleBookFetcherTest::testAuthor() { Tellico::Fetch::FetchRequest request(Tellico::Data::Collection::Book, Tellico::Fetch::Person, QLatin1String("Shelley Powers")); Tellico::Fetch::Fetcher::Ptr fetcher(new Tellico::Fetch::GoogleBookFetcher(this)); if(m_hasConfigFile) { KConfigGroup cg(&m_config, QLatin1String("GoogleBookTest")); fetcher->readConfig(cg, cg.name()); } Tellico::Data::EntryList results = DO_FETCH(fetcher, request); Tellico::Data::EntryPtr entry; foreach(Tellico::Data::EntryPtr testEntry, results) { if(testEntry->title() == QLatin1String("Practical RDF")) { entry = testEntry; break; } } QVERIFY(entry); compareEntry(entry); }