summaryrefslogtreecommitdiffstats
path: root/src/lib/dhcpsrv
diff options
context:
space:
mode:
authorRazvan Becheriu <razvan@isc.org>2024-01-25 12:35:39 +0100
committerRazvan Becheriu <razvan@isc.org>2024-01-26 13:19:54 +0100
commit48a4661d3608deb6aaddd109d1427ff342160937 (patch)
tree634a008adc980c097d808194d805dcbf02ec6f3b /src/lib/dhcpsrv
parent[#1790] add tool to parse CB parameters (diff)
downloadkea-48a4661d3608deb6aaddd109d1427ff342160937.tar.xz
kea-48a4661d3608deb6aaddd109d1427ff342160937.zip
[#1790] added UTs
Diffstat (limited to 'src/lib/dhcpsrv')
-rw-r--r--src/lib/dhcpsrv/testutils/generic_backend_unittest.cc21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/lib/dhcpsrv/testutils/generic_backend_unittest.cc b/src/lib/dhcpsrv/testutils/generic_backend_unittest.cc
index 462dbdfa09..ff3f6914a3 100644
--- a/src/lib/dhcpsrv/testutils/generic_backend_unittest.cc
+++ b/src/lib/dhcpsrv/testutils/generic_backend_unittest.cc
@@ -115,9 +115,25 @@ GenericBackendTest::checkConfiguredGlobal(const SrvConfigPtr& srv_cfg,
const std::string &name,
ConstElementPtr exp_value) {
ConstCfgGlobalsPtr globals = srv_cfg->getConfiguredGlobals();
- ConstElementPtr found_global = globals->get(name);
+ std::string name_elem = name;
+ std::string sub_elem;
+ auto pos = name_elem.find('/');
+ if (pos != std::string::npos) {
+ sub_elem = name_elem.substr(pos + 1);
+ name_elem = name_elem.substr(0, pos);
+ }
+
+ ConstElementPtr found_global = globals->get(name_elem);
ASSERT_TRUE(found_global) << "expected global: "
- << name << " not found";
+ << name_elem << " not found";
+
+ if (!sub_elem.empty()) {
+ ASSERT_EQ(Element::map, found_global->getType())
+ << "expected global: " << name_elem << " has wrong type";
+ found_global = found_global->get(sub_elem);
+ ASSERT_TRUE(found_global) << "expected global: "
+ << name << " not found";
+ }
ASSERT_EQ(exp_value->getType(), found_global->getType())
<< "expected global: " << name << " has wrong type";
@@ -132,7 +148,6 @@ GenericBackendTest::checkConfiguredGlobal(const SrvConfigPtr& srv_cfg,
checkConfiguredGlobal(srv_cfg, exp_global->getName(), exp_global->getElementValue());
}
-
void
GenericBackendTest::testNewAuditEntry(const std::string& exp_object_type,
const AuditEntry::ModificationType& exp_modification_type,