}
}
+void checkAliasExistsAtStore(int expectedResult, int expectedUnique, std::string alias, bool isInstallCert)
+{
+ if (isInstallCert)
+ installCertToStore(std::string(), std::string(), PemCertInfo::CertPEM.c_str(), PEM_CRT);
+
+ int unique = 0, result;
+ for (auto storeType : storeTypeMap)
+ {
+ result = checkAliasExistsInStore(storeType.second, alias.empty() ? NULL : alias.c_str(), &unique);
+
+ BOOST_CHECK_EQUAL(result, expectedResult);
+ BOOST_CHECK_EQUAL(unique, expectedUnique);
+ }
+
+ if (isInstallCert)
+ uninstallCertFromStore();
+}
+
BOOST_AUTO_TEST_SUITE(CERT_SERVER_LOGIC_TEST)
POSITIVE_TEST_CASE(T_get_certificate_status_from_store)
}
}
+POSITIVE_TEST_CASE(T_check_alias_exists_in_store)
+{
+ int result = initialize_db();
+ BOOST_CHECK_EQUAL(result, CERTSVC_SUCCESS);
+
+ checkAliasExistsAtStore(CERTSVC_SUCCESS, 0, commonNamePrefix, true);
+
+ checkAliasExistsAtStore(CERTSVC_SUCCESS, 1, commonNamePrefix, false);
+
+ deinitialize_db();
+}
+
+NEGATIVE_TEST_CASE(T_check_alias_exists_in_store_with_alias_param_null_and_db_no_init)
+{
+ checkAliasExistsAtStore(CERTSVC_WRONG_ARGUMENT, 0, std::string(), false);
+
+ checkAliasExistsAtStore(CERTSVC_FAIL, 0, commonNamePrefix, false);
+}
+
POSITIVE_TEST_CASE(T_install_certificate_to_store)
{
int result;