Lines Matching +full:sub +full:- +full:bus
3 #include "phosphor-ldap-config/ldap_config.hpp"
4 #include "phosphor-ldap-config/ldap_config_mgr.hpp"
8 #include <sdbusplus/bus.hpp>
33 TestLDAPConfig() : bus(sdbusplus::bus::new_default()) {} in TestLDAPConfig()
67 sdbusplus::bus_t bus; member in phosphor::ldap::TestLDAPConfig
73 MockConfigMgr(sdbusplus::bus_t& bus, const char* path, const char* filePath, in MockConfigMgr() argument
76 phosphor::ldap::ConfigMgr(bus, path, filePath, dbusPersistentFile, in MockConfigMgr()
88 return getADConfigPtr()->ldapBindPassword; in configBindPassword()
108 return ADConfigPtr->secureLDAP; in secureLDAP()
126 MockConfigMgr manager(bus, LDAP_CONFIG_ROOT, configFilePath.c_str(), in TEST_F()
136 "MyLdap12", ldap_base::Create::SearchScope::sub, in TEST_F()
138 manager.getADConfigPtr()->enabled(true); in TEST_F()
142 ldap_base::Create::SearchScope::sub, in TEST_F()
144 manager.getOpenLdapConfigPtr()->enabled(false); in TEST_F()
147 // that in-active config should not call the start/stop service. in TEST_F()
148 manager.getOpenLdapConfigPtr()->userNameAttribute("abc"); in TEST_F()
149 EXPECT_EQ(manager.getOpenLdapConfigPtr()->userNameAttribute(), "abc"); in TEST_F()
151 manager.getOpenLdapConfigPtr()->groupNameAttribute("def"); in TEST_F()
152 EXPECT_EQ(manager.getOpenLdapConfigPtr()->groupNameAttribute(), "def"); in TEST_F()
155 EXPECT_EQ(manager.getADConfigPtr()->ldapServerURI(), in TEST_F()
157 EXPECT_EQ(manager.getADConfigPtr()->ldapBindDN(), "cn=Users,dc=com"); in TEST_F()
158 EXPECT_EQ(manager.getADConfigPtr()->ldapBaseDN(), "cn=Users,dc=corp"); in TEST_F()
159 EXPECT_EQ(manager.getADConfigPtr()->ldapSearchScope(), in TEST_F()
160 ldap_base::Config::SearchScope::sub); in TEST_F()
161 EXPECT_EQ(manager.getADConfigPtr()->ldapType(), in TEST_F()
164 EXPECT_EQ(manager.getADConfigPtr()->userNameAttribute(), "uid"); in TEST_F()
165 EXPECT_EQ(manager.getADConfigPtr()->groupNameAttribute(), "gid"); in TEST_F()
166 EXPECT_EQ(manager.getADConfigPtr()->ldapBindDNPassword(), ""); in TEST_F()
169 manager.getADConfigPtr()->ldapBindDNPassword("MyLdap14"); in TEST_F()
170 EXPECT_EQ(manager.getADConfigPtr()->ldapBindDNPassword(), ""); in TEST_F()
187 MockConfigMgr manager(bus, LDAP_CONFIG_ROOT, configFilePath.c_str(), in TEST_F()
195 EXPECT_EQ(manager.getADConfigPtr()->ldapType(), in TEST_F()
197 EXPECT_EQ(manager.getOpenLdapConfigPtr()->ldapType(), in TEST_F()
214 MockConfigMgr manager(bus, LDAP_CONFIG_ROOT, configFilePath.c_str(), in TEST_F()
226 EXPECT_EQ(manager.getADConfigPtr()->ldapType(), in TEST_F()
228 EXPECT_EQ(manager.getOpenLdapConfigPtr()->ldapType(), in TEST_F()
230 EXPECT_FALSE(manager.getADConfigPtr()->enabled()); in TEST_F()
231 EXPECT_FALSE(manager.getOpenLdapConfigPtr()->enabled()); in TEST_F()
247 new MockConfigMgr(bus, LDAP_CONFIG_ROOT, configFilePath.c_str(), in TEST_F()
253 managerPtr->createConfig( in TEST_F()
255 "MyLdap12", ldap_base::Create::SearchScope::sub, in TEST_F()
257 managerPtr->getADConfigPtr()->enabled(false); in TEST_F()
259 EXPECT_FALSE(managerPtr->getADConfigPtr()->enabled()); in TEST_F()
260 managerPtr->getADConfigPtr()->enabled(true); in TEST_F()
264 managerPtr->restore(); in TEST_F()
266 EXPECT_TRUE(managerPtr->getADConfigPtr()->enabled()); in TEST_F()
267 EXPECT_EQ(managerPtr->getADConfigPtr()->ldapServerURI(), in TEST_F()
269 EXPECT_EQ(managerPtr->getADConfigPtr()->ldapBindDN(), "cn=Users,dc=com"); in TEST_F()
270 EXPECT_EQ(managerPtr->getADConfigPtr()->ldapBaseDN(), "cn=Users,dc=corp"); in TEST_F()
271 EXPECT_EQ(managerPtr->getADConfigPtr()->ldapSearchScope(), in TEST_F()
272 ldap_base::Config::SearchScope::sub); in TEST_F()
273 EXPECT_EQ(managerPtr->getADConfigPtr()->ldapType(), in TEST_F()
275 EXPECT_EQ(managerPtr->getADConfigPtr()->userNameAttribute(), "uid"); in TEST_F()
276 EXPECT_EQ(managerPtr->getADConfigPtr()->groupNameAttribute(), "gid"); in TEST_F()
277 EXPECT_EQ(managerPtr->getADConfigPtr()->ldapBindDNPassword(), ""); in TEST_F()
278 EXPECT_EQ(managerPtr->configBindPassword(), "MyLdap12"); in TEST_F()
295 new MockConfigMgr(bus, LDAP_CONFIG_ROOT, configFilePath.c_str(), in TEST_F()
303 managerPtr->createConfig( in TEST_F()
305 "MyLdap12", ldap_base::Create::SearchScope::sub, in TEST_F()
307 managerPtr->getADConfigPtr()->enabled(true); in TEST_F()
310 managerPtr->getADConfigPtr()->ldapServerURI("ldap://9.194.251.139/"); in TEST_F()
311 EXPECT_EQ(managerPtr->getADConfigPtr()->ldapServerURI(), in TEST_F()
317 managerPtr->getADConfigPtr()->ldapServerURI("ldaps://9.194.251.139/"), in TEST_F()
321 EXPECT_EQ(managerPtr->getADConfigPtr()->ldapServerURI(), in TEST_F()
324 managerPtr->restore(); in TEST_F()
326 EXPECT_EQ(managerPtr->getADConfigPtr()->ldapServerURI(), in TEST_F()
344 new MockConfigMgr(bus, LDAP_CONFIG_ROOT, configFilePath.c_str(), in TEST_F()
352 managerPtr->createConfig( in TEST_F()
354 "MyLdap12", ldap_base::Create::SearchScope::sub, in TEST_F()
356 managerPtr->getADConfigPtr()->enabled(true); in TEST_F()
359 managerPtr->getADConfigPtr()->ldapBindDN( in TEST_F()
361 EXPECT_EQ(managerPtr->getADConfigPtr()->ldapBindDN(), in TEST_F()
368 managerPtr->getADConfigPtr()->ldapBindDN(""); in TEST_F()
377 managerPtr->restore(); in TEST_F()
379 EXPECT_EQ(managerPtr->getADConfigPtr()->ldapBindDN(), in TEST_F()
397 new MockConfigMgr(bus, LDAP_CONFIG_ROOT, configFilePath.c_str(), in TEST_F()
403 managerPtr->createConfig( in TEST_F()
405 "MyLdap12", ldap_base::Create::SearchScope::sub, in TEST_F()
407 managerPtr->getADConfigPtr()->enabled(true); in TEST_F()
409 managerPtr->getADConfigPtr()->ldapBaseDN( in TEST_F()
411 EXPECT_EQ(managerPtr->getADConfigPtr()->ldapBaseDN(), in TEST_F()
418 managerPtr->getADConfigPtr()->ldapBaseDN(""); in TEST_F()
427 managerPtr->restore(); in TEST_F()
429 EXPECT_EQ(managerPtr->getADConfigPtr()->ldapBaseDN(), in TEST_F()
447 new MockConfigMgr(bus, LDAP_CONFIG_ROOT, configFilePath.c_str(), in TEST_F()
453 managerPtr->createConfig( in TEST_F()
455 "MyLdap12", ldap_base::Create::SearchScope::sub, in TEST_F()
457 managerPtr->getADConfigPtr()->enabled(true); in TEST_F()
460 managerPtr->getADConfigPtr()->ldapSearchScope( in TEST_F()
462 EXPECT_EQ(managerPtr->getADConfigPtr()->ldapSearchScope(), in TEST_F()
465 managerPtr->restore(); in TEST_F()
467 EXPECT_EQ(managerPtr->getADConfigPtr()->ldapSearchScope(), in TEST_F()
485 new MockConfigMgr(bus, LDAP_CONFIG_ROOT, configFilePath.c_str(), in TEST_F()
491 managerPtr->createConfig( in TEST_F()
493 "MyLdap12", ldap_base::Create::SearchScope::sub, in TEST_F()
495 managerPtr->getADConfigPtr()->enabled(true); in TEST_F()
499 EXPECT_THROW(managerPtr->getADConfigPtr()->ldapType( in TEST_F()
502 EXPECT_EQ(managerPtr->getADConfigPtr()->ldapType(), in TEST_F()
505 managerPtr->restore(); in TEST_F()
507 EXPECT_EQ(managerPtr->getADConfigPtr()->ldapType(), in TEST_F()
525 new MockConfigMgr(bus, LDAP_CONFIG_ROOT, configFilePath.c_str(), in TEST_F()
531 managerPtr->createConfig( in TEST_F()
533 "MyLdap12", ldap_base::Create::SearchScope::sub, in TEST_F()
535 managerPtr->getADConfigPtr()->enabled(true); in TEST_F()
536 EXPECT_TRUE(managerPtr->secureLDAP()); in TEST_F()
537 managerPtr->restore(); in TEST_F()
539 EXPECT_TRUE(managerPtr->secureLDAP()); in TEST_F()
557 new MockConfigMgr(bus, LDAP_CONFIG_ROOT, configFilePath.c_str(), in TEST_F()
563 managerPtr->createConfig( in TEST_F()
565 "MyLdap12", ldap_base::Create::SearchScope::sub, in TEST_F()
567 managerPtr->getADConfigPtr()->enabled(true); in TEST_F()
594 new MockConfigMgr(bus, LDAP_CONFIG_ROOT, configFilePath.c_str(), in TEST_F()
600 managerPtr->createConfig( in TEST_F()
602 "MyLdap12", ldap_base::Create::SearchScope::sub, in TEST_F()
605 managerPtr->createConfig( in TEST_F()
607 "MyLdap123", ldap_base::Create::SearchScope::sub, in TEST_F()
611 managerPtr->getADConfigPtr()->enabled(true); in TEST_F()
613 EXPECT_EQ(managerPtr->getADConfigPtr()->enabled(), true); in TEST_F()
614 EXPECT_EQ(managerPtr->getOpenLdapConfigPtr()->enabled(), false); in TEST_F()
621 managerPtr->getOpenLdapConfigPtr()->enabled(true); in TEST_F()
630 EXPECT_EQ(managerPtr->getADConfigPtr()->enabled(), true); in TEST_F()
631 EXPECT_EQ(managerPtr->getOpenLdapConfigPtr()->enabled(), false); in TEST_F()
633 managerPtr->getADConfigPtr()->enabled(false); in TEST_F()
634 EXPECT_EQ(managerPtr->getADConfigPtr()->enabled(), false); in TEST_F()
635 EXPECT_EQ(managerPtr->getOpenLdapConfigPtr()->enabled(), false); in TEST_F()
637 managerPtr->getOpenLdapConfigPtr()->enabled(true); in TEST_F()
638 EXPECT_EQ(managerPtr->getOpenLdapConfigPtr()->enabled(), true); in TEST_F()
639 EXPECT_EQ(managerPtr->getADConfigPtr()->enabled(), false); in TEST_F()
656 MockConfigMgr manager(bus, LDAP_CONFIG_ROOT, configFilePath.c_str(), in TEST_F()
660 // Create the priv-mapping under the config. in TEST_F()
661 manager.getADConfigPtr()->create("admin", "priv-admin"); in TEST_F()
667 manager.getADConfigPtr()->checkPrivilegeMapper("admin"); in TEST_F()
689 MockConfigMgr manager(bus, LDAP_CONFIG_ROOT, configFilePath.c_str(), in TEST_F()
693 // Create the priv-mapping under the config. in TEST_F()
694 manager.getADConfigPtr()->create("admin", "priv-admin"); in TEST_F()
695 manager.getADConfigPtr()->create("user", "priv-user"); in TEST_F()
701 manager.getADConfigPtr()->checkPrivilegeMapper("admin"); in TEST_F()
702 manager.getADConfigPtr()->checkPrivilegeMapper("user"); in TEST_F()
712 manager.getADConfigPtr()->deletePrivilegeMapper(1); in TEST_F()
713 EXPECT_NO_THROW(manager.getADConfigPtr()->checkPrivilegeMapper("admin")); in TEST_F()
714 manager.getADConfigPtr()->deletePrivilegeMapper(2); in TEST_F()
715 EXPECT_NO_THROW(manager.getADConfigPtr()->checkPrivilegeMapper("user")); in TEST_F()
730 MockConfigMgr manager(bus, LDAP_CONFIG_ROOT, configFilePath.c_str(), in TEST_F()
734 // Create the priv-mapping under the config. in TEST_F()
735 manager.getADConfigPtr()->create("admin", "priv-admin"); in TEST_F()
736 manager.getOpenLdapConfigPtr()->create("user", "priv-user"); in TEST_F()
742 manager.getADConfigPtr()->checkPrivilegeMapper("admin"); in TEST_F()
755 manager.getOpenLdapConfigPtr()->checkPrivilegeMapper("user"); in TEST_F()
777 MockConfigMgr manager(bus, LDAP_CONFIG_ROOT, configFilePath.c_str(), in TEST_F()
783 std::string privilege = "priv-admin"; in TEST_F()
790 bus, dbusPath.c_str(), dbusPersistentFilePath.c_str(), groupName, in TEST_F()
793 EXPECT_NO_THROW(entry->privilege("priv-operator")); in TEST_F()
794 EXPECT_NO_THROW(entry->privilege("priv-user")); in TEST_F()