]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[4096] Added unit test for an blank client class name
authorThomas Markwalder <tmark@isc.org>
Thu, 19 Nov 2015 15:21:30 +0000 (10:21 -0500)
committerThomas Markwalder <tmark@isc.org>
Thu, 19 Nov 2015 15:21:30 +0000 (10:21 -0500)
src/lib/dhcpsrv/tests/client_class_def_parser_unittest.cc

index fd831aaf98f760847d370a580d126e2b6828b989..5e95767e4f380e245d9977760e61b05511b7343d 100644 (file)
@@ -370,7 +370,7 @@ TEST_F(ClientClassDefParserTest, noClassName) {
 
     std::string cfg_text =
         "{ \n"
-        "    \"test\": \"vendor-class-identifier == 'MSFT'\", \n"
+        "    \"test\": \"option[123] == 'abc'\", \n"
         "    \"option-data\": [ \n"
         "        { \n"
         "           \"name\": \"domain-name-servers\", \n"
@@ -387,6 +387,30 @@ TEST_F(ClientClassDefParserTest, noClassName) {
                  DhcpConfigError);
 }
 
+// Verifies that a class with a blank name, fails to parse.
+TEST_F(ClientClassDefParserTest, blankClassName) {
+
+    std::string cfg_text =
+        "{ \n"
+        "    \"name\": \"\", \n"
+        "    \"test\": \"option[123] == 'abc'\", \n"
+        "    \"option-data\": [ \n"
+        "        { \n"
+        "           \"name\": \"domain-name-servers\", \n"
+        "           \"code\": 6, \n"
+        "           \"space\": \"dhcp4\", \n"
+        "           \"csv-format\": true, \n"
+        "           \"data\": \"192.0.2.1, 192.0.2.2\" \n"
+        "        } \n"
+        "      ] \n"
+        "} \n";
+
+    ClientClassDefPtr cclass;
+    ASSERT_THROW(cclass = parseClientClassDef(cfg_text, Option::V4),
+                 DhcpConfigError);
+}
+
+
 // Verifies that a class with an unknown element, fails to parse.
 TEST_F(ClientClassDefParserTest, unknownElement) {
     std::string cfg_text =