From 44f16b6cd5b9cd9641c0c5df1c671c9e610ad7ac Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 6 Nov 2020 15:28:10 -0500 Subject: Added mod installation to cli interface --- testLibbible.cc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'testLibbible.cc') diff --git a/testLibbible.cc b/testLibbible.cc index ad51c44..b06a0bd 100644 --- a/testLibbible.cc +++ b/testLibbible.cc @@ -29,6 +29,7 @@ class TestLibbible : public CppUnit::TestFixture CPPUNIT_TEST(testGetPassages); CPPUNIT_TEST(testGetText); CPPUNIT_TEST(testSettings); + CPPUNIT_TEST(testDownload); CPPUNIT_TEST_SUITE_END(); //public: @@ -40,6 +41,7 @@ class TestLibbible : public CppUnit::TestFixture void testGetPassages(void); void testGetText(void); void testSettings(void); + void testDownload(void); }; @@ -171,6 +173,27 @@ void TestLibbible::testSettings(void) { libbible::settingsWrite("test", ""); CPPUNIT_ASSERT(libbible::settingsRead("test") == ""); } + +void TestLibbible::testDownload(void) { + map> modsAvailable = libbible::downloadModsAvailable(); + // We try installing the first available one + string language; + string name; + for(auto pair : modsAvailable) { + language = pair.first; + name = pair.second[0]; + break; + } + CPPUNIT_ASSERT(!language.empty() && !name.empty()); + // Try uninstalling it (shouldn't crash or have nasty side effects!) + libbible::uninstallMod(name); + auto mods = libbible::getModules(); + CPPUNIT_ASSERT(mods.find(name) == mods.end()); + libbible::installModFromInternet(language, name); + mods = libbible::getModules(); + CPPUNIT_ASSERT(mods.find(name) != mods.end()); + +} //----------------------------------------------------------------------------- CPPUNIT_TEST_SUITE_REGISTRATION( TestLibbible ); -- cgit v1.2.3