]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[3983] Unit-tests for incorrect decline-probation-period added.
authorTomek Mrugalski <tomasz@isc.org>
Wed, 2 Sep 2015 11:37:34 +0000 (13:37 +0200)
committerTomek Mrugalski <tomasz@isc.org>
Wed, 2 Sep 2015 11:37:34 +0000 (13:37 +0200)
src/bin/dhcp4/tests/config_parser_unittest.cc
src/bin/dhcp6/tests/config_parser_unittest.cc

index 91c816a7d987da5adb4f7918d8cdca42594c9373..46ee547d10f6372951cb981cdbaea0eca5dc6657 100644 (file)
@@ -3692,5 +3692,24 @@ TEST_F(Dhcp4ParserTest, declineTimer) {
               CfgMgr::instance().getStagingCfg()->getDeclinePeriod());
 }
 
+/// Check that an incorrect decline-probation-period value will be caught.
+TEST_F(Dhcp4ParserTest, declineTimerError) {
+    ConstElementPtr status;
+
+    string config = "{ " + genIfaceConfig() + "," +
+        "\"decline-probation-period\": \"soon\","
+        "\"subnet4\": [ ]"
+        "}";
+
+    ElementPtr json = Element::fromJSON(config);
+
+    EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json));
+
+    // returned value should be 1 (error)
+    checkResult(status, 1);
+
+    // Check that the error contains error position.
+    EXPECT_TRUE(errorContainsPosition(status, "<string>"));
+}
 
 }
index 6e9f7383488c53933a3b0d37d39eb4bf8e3e6a27..26c97329030de352a177d1520f77d5fc8d759473 100644 (file)
@@ -4026,6 +4026,25 @@ TEST_F(Dhcp6ParserTest, declineTimer) {
               CfgMgr::instance().getStagingCfg()->getDeclinePeriod());
 }
 
+/// Check that an incorrect decline-probation-period value will be caught.
+TEST_F(Dhcp6ParserTest, declineTimerError) {
+    ConstElementPtr status;
+
+    string config = "{ " + genIfaceConfig() + "," +
+        "\"decline-probation-period\": \"soon\","
+        "\"subnet6\": [ ]"
+        "}";
+
+    ElementPtr json = Element::fromJSON(config);
+
+    EXPECT_NO_THROW(status = configureDhcp6Server(srv_, json));
+
+    // returned value should be 1 (error)
+    checkResult(status, 1);
+
+    // Check that the error contains error position.
+    EXPECT_TRUE(errorContainsPosition(status, "<string>"));
+}
 
 
 };