]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5017] Finished config_parser_unittest.cc files
authorFrancis Dupont <fdupont@isc.org>
Sat, 17 Dec 2016 14:51:22 +0000 (15:51 +0100)
committerFrancis Dupont <fdupont@isc.org>
Sat, 17 Dec 2016 14:51:22 +0000 (15:51 +0100)
src/bin/dhcp4/tests/config_parser_unittest.cc
src/bin/dhcp6/tests/config_parser_unittest.cc

index ba940b516f444eb3f05fd65ddd5e154ad8017a63..17e8ec74c9f3a8b1ddbf9264301320d0db425e88 100644 (file)
@@ -3811,6 +3811,8 @@ TEST_F(Dhcp4ParserTest, reservationBogus) {
     EXPECT_NO_THROW(x = configureDhcp4Server(*srv_, json));
     checkResult(x, 1);
 
+    EXPECT_THROW(parseDHCP4(config), Dhcp4ParseError);
+
     // Case 2: DUID and HW Address both specified.
     config = "{ " + genIfaceConfig() + "," +
         "\"rebind-timer\": 2000, "
@@ -4035,6 +4037,9 @@ TEST_F(Dhcp4ParserTest, declineTimerError) {
 
     // Check that the error contains error position.
     EXPECT_TRUE(errorContainsPosition(status, "<string>"));
+
+    // Check that the Dhcp4 parser catches the type error
+    EXPECT_THROW(parseDHCP4(config), Dhcp4ParseError);
 }
 
 // Check that configuration for the expired leases processing may be
@@ -4427,6 +4432,8 @@ TEST_F(Dhcp4ParserTest, invalidClientClassDictionary) {
     EXPECT_NO_THROW(status = configureDhcp4Server(*srv_, json));
     ASSERT_TRUE(status);
     checkResult(status, 1);
+
+    EXPECT_THROW(parseDHCP4(config), Dhcp4ParseError);
 }
 
 // Test verifies that regular configuration does not provide any user context
index 460fc625b42666d9c3220d559ace0ec02135281d..fe282e7806cd601c562b308ac75fbbddfb441827 100644 (file)
@@ -1579,8 +1579,8 @@ TEST_F(Dhcp6ParserTest, pdPoolPrefixExclude) {
         "] }";
 
     // Convert the JSON string into Elements.
-    ElementPtr json;
-    ASSERT_NO_THROW(json = Element::fromJSON(config));
+    ConstElementPtr json;
+    ASSERT_NO_THROW(json = parseDHCP6(config));
 
     // Verify that DHCP6 configuration processing succeeds.
     // Returned value must be non-empty ConstElementPtr to config result.