diff options
author | Your Name <you@example.com> | 2020-11-06 15:28:10 -0500 |
---|---|---|
committer | Your Name <you@example.com> | 2020-11-06 15:28:10 -0500 |
commit | 44f16b6cd5b9cd9641c0c5df1c671c9e610ad7ac (patch) | |
tree | 47e540ac3e98d8f68a0e0ab36f1c1bc03beb2d35 /testLibbible.cc | |
parent | 7fc8ebf27892eb02488fd2e75ca35ae48f596782 (diff) | |
download | libbible-44f16b6cd5b9cd9641c0c5df1c671c9e610ad7ac.tar.gz libbible-44f16b6cd5b9cd9641c0c5df1c671c9e610ad7ac.tar.bz2 libbible-44f16b6cd5b9cd9641c0c5df1c671c9e610ad7ac.zip |
Added mod installation to cli interface
Diffstat (limited to 'testLibbible.cc')
-rw-r--r-- | testLibbible.cc | 23 |
1 files changed, 23 insertions, 0 deletions
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<string, vector<string>> 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 ); |