}
}
+void getCertStatusFromStore(int expectedResult, CertStatus expectedStatus, bool isInstallCert)
+{
+ int result;
+ for (auto storeType : storeTypeMap)
+ {
+ CertStatus status = DISABLED;
+ if (isInstallCert)
+ installCertToStore(std::string(), std::string(), PemCertInfo::CertPEM.c_str(), PEM_CRT);
+
+ result = getCertificateStatusFromStore(storeType.second, gNamePrefix.c_str(), &status);
+
+ BOOST_CHECK_EQUAL(result, expectedResult);
+ BOOST_CHECK_EQUAL(status, expectedStatus);
+
+ if (isInstallCert)
+ uninstallCertFromStore();
+ }
+}
+
BOOST_AUTO_TEST_SUITE(CERT_SERVER_LOGIC_TEST)
+POSITIVE_TEST_CASE(T_get_certificate_status_from_store)
+{
+ int result = initialize_db();
+ BOOST_CHECK_EQUAL(result, CERTSVC_SUCCESS);
+
+ getCertStatusFromStore(CERTSVC_SUCCESS, ENABLED, true);
+
+ deinitialize_db();
+}
+
+NEGATIVE_TEST_CASE(T_get_certificate_status_from_store_with_no_records)
+{
+ int result = initialize_db();
+ BOOST_CHECK_EQUAL(result, CERTSVC_SUCCESS);
+
+ getCertStatusFromStore(CERTSVC_FAIL, DISABLED, false);
+
+ deinitialize_db();
+}
+
+NEGATIVE_TEST_CASE(T_get_certificate_status_from_store_with_gname_param_null_and_db_no_init)
+{
+ int result;
+ for (auto storeType : storeTypeMap)
+ {
+ result = getCertificateStatusFromStore(storeType.second, NULL, NULL);
+ BOOST_CHECK_EQUAL(result, CERTSVC_WRONG_ARGUMENT);
+
+ CertStatus status;
+ result = getCertificateStatusFromStore(storeType.second, gNamePrefix.c_str(), &status);
+ BOOST_CHECK_EQUAL(result, CERTSVC_FAIL);
+ }
+}
+
POSITIVE_TEST_CASE(T_set_certificate_status_to_store)
{
int result = initialize_db();