Browse Source

[5377] One unit-test added.

Tomek Mrugalski 7 years ago
parent
commit
7ffa4c6882
1 changed files with 19 additions and 0 deletions
  1. 19 0
      src/bin/dhcp4/tests/parser_unittest.cc

+ 19 - 0
src/bin/dhcp4/tests/parser_unittest.cc

@@ -261,6 +261,25 @@ TEST(ParserTest, file) {
     }
 }
 
+// Basic test that checks if it's possible to specify outbound-interface.
+TEST(ParserTest, outboundIface) {
+    std::string fname = string(CFG_EXAMPLES) + "/" + "advanced.json";
+    Parser4Context ctx;
+    ConstElementPtr test_json = ctx.parseFile(fname, Parser4Context::PARSER_DHCP4);
+
+    ConstElementPtr tmp;
+    tmp = test_json->get("Dhcp4");
+    ASSERT_TRUE(tmp);
+
+    tmp = tmp->get("interfaces-config");
+    ASSERT_TRUE(tmp);
+
+    tmp = tmp->get("outbound-interface");
+    ASSERT_TRUE(tmp);
+    EXPECT_EQ(Element::string, tmp->getType());
+    EXPECT_EQ("use-routing", tmp->stringValue());
+}
+
 /// @brief Tests error conditions in Dhcp4Parser
 ///
 /// @param txt text to be parsed