]> granicus.if.org Git - icinga2/commitdiff
Fix ApiUser unit test 6148/head
authorGunnar Beutner <gunnar.beutner@icinga.com>
Tue, 6 Mar 2018 08:30:22 +0000 (09:30 +0100)
committerGunnar Beutner <gunnar.beutner@icinga.com>
Tue, 6 Mar 2018 08:30:22 +0000 (09:30 +0100)
test/remote-user.cpp

index 2979285b9adad3ebe4214bbb88451981acc2b721..f43816a199b9105bb9c3d3d730a78251ad0272cc 100644 (file)
@@ -29,14 +29,13 @@ BOOST_AUTO_TEST_SUITE(api_user)
 
 BOOST_AUTO_TEST_CASE(password)
 {
-#ifndef I2_DEBUG
-       std::cout << "Only enabled in Debug builds..." << std::endl;
-#else
        ApiUser::Ptr user = new ApiUser();
        String passwd = RandomString(16);
        String salt = RandomString(8);
-       user->SetPassword("ThisShouldBeIgnored");
-       user->SetPasswordHash(CreateHashedPasswordString(passwd, salt, true));
+       user->SetPasswordHash(CreateHashedPasswordString(passwd, salt));
+       user->OnConfigLoaded();
+       user->OnAllConfigLoaded();
+       user->Start();
 
        BOOST_CHECK(user->GetPasswordHash() != passwd);
 
@@ -46,7 +45,6 @@ BOOST_AUTO_TEST_CASE(password)
        BOOST_CHECK(passwdd->Get("salt") == salt);
        BOOST_CHECK(ComparePassword(passwdd->Get("password"), passwd, salt));
        BOOST_CHECK(!ComparePassword(passwdd->Get("password"), "wrong password uwu!", salt));
-#endif
 }
 
 BOOST_AUTO_TEST_SUITE_END()