improve the robustness of ndncert library
Change-Id: Iaabc4d8f28ca27a7e7f501ebd122c5231ceb3ac0
diff --git a/tests/unit-tests/ca-config.t.cpp b/tests/unit-tests/ca-config.t.cpp
index 0cebb26..5b47505 100644
--- a/tests/unit-tests/ca-config.t.cpp
+++ b/tests/unit-tests/ca-config.t.cpp
@@ -32,7 +32,7 @@
BOOST_FIXTURE_TEST_SUITE(TestCaConfig, IdentityManagementFixture)
-BOOST_AUTO_TEST_CASE(ReadConfigFileWithFileAnchor)
+BOOST_AUTO_TEST_CASE(ReadConfigFile)
{
CaConfig config;
config.load("tests/unit-tests/ca.conf.test");
@@ -43,6 +43,24 @@
BOOST_CHECK_EQUAL(config.m_caInfo, "ndn testbed ca");
}
+BOOST_AUTO_TEST_CASE(ReadNonexistConfigFile)
+{
+ CaConfig config;
+ BOOST_CHECK_THROW(config.load("tests/unit-tests/Nonexist"), CaConfig::Error);
+}
+
+BOOST_AUTO_TEST_CASE(ReadConfigFileWithoutCaPrefix)
+{
+ CaConfig config;
+ BOOST_CHECK_THROW(config.load("tests/unit-tests/ca.conf.test2"), CaConfig::Error);
+}
+
+BOOST_AUTO_TEST_CASE(ReadConfigFileWithChallengeNotSupported)
+{
+ CaConfig config;
+ BOOST_CHECK_THROW(config.load("tests/unit-tests/ca.conf.test3"), CaConfig::Error);
+}
+
BOOST_AUTO_TEST_SUITE_END() // TestCaConfig
} // namespace tests