From e48416cc16004e2768e43aa9839ad338e223d784 Mon Sep 17 00:00:00 2001 From: tranthanhtung2001 Date: Fri, 16 Aug 2024 14:31:43 +0700 Subject: [PATCH] Add test case for vcore_client_get_certificate_list_from_store function in Client.cpp Change-Id: I70130fd9c0d5641ffa4d34c9d9b9f2514036f930 Signed-off-by: tranthanhtung2001 --- unit-tests/test_vcore_client.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/unit-tests/test_vcore_client.cpp b/unit-tests/test_vcore_client.cpp index 60c15ad..bbbfc30 100644 --- a/unit-tests/test_vcore_client.cpp +++ b/unit-tests/test_vcore_client.cpp @@ -253,6 +253,24 @@ NEGATIVE_TEST_CASE(T_vcore_client_get_certificate_from_store_with_param_wrong) free(certData); } +POSITIVE_TEST_CASE(T_vcore_client_get_certificate_list_from_store) +{ + CertSvcStoreCertList *achivedList; + + size_t length = 0; + int result = vcore_client_get_certificate_list_from_store(VPN_STORE, ENABLED, &achivedList, &length); + + BOOST_CHECK_EQUAL(result, CERTSVC_SUCCESS); + BOOST_CHECK_EQUAL(length, 1); + + BOOST_CHECK_EQUAL(std::strcmp(achivedList->gname, ValidGname.c_str()), 0); + BOOST_CHECK_EQUAL(std::strcmp(achivedList->title, CommonName.c_str()), 0); + + free(achivedList->gname); + free(achivedList->title); + free(achivedList); +} + POSITIVE_TEST_CASE(T_vcore_client_delete_certificate_from_store) { int result; -- 2.7.4