Add GetTestCertificate() for testing purpose
authorJunghyun Yeon <jungh.yeon@samsung.com>
Wed, 2 Jun 2021 02:55:24 +0000 (11:55 +0900)
committer연정현/Tizen Platform Lab(SR)/Staff Engineer/삼성전자 <jungh.yeon@samsung.com>
Thu, 3 Jun 2021 10:05:07 +0000 (19:05 +0900)
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
test/unit_tests/parcel_utils.cc
test/unit_tests/parcel_utils.hh

index 0010b33..21460d2 100644 (file)
@@ -834,3 +834,20 @@ bool IsEqualDepInfo(const std::vector<dependency_x*>& depA,
 
   return true;
 }
+
+pkgmgr_certinfo_x *GetTestCertificate() {
+  pkgmgr_certinfo_x* cert_info = reinterpret_cast<pkgmgr_certinfo_x*>(
+      calloc(1, sizeof(pkgmgr_certinfo_x)));
+
+  cert_info->for_all_users = 1;
+  cert_info->pkgid = strdup("test_pkgid");
+  cert_info->cert_value = strdup("test_certvalue");
+  for (int i = 0; i < MAX_CERT_TYPE; i++) {
+    std::string cert_value(std::to_string(i));
+    cert_value += "test_cert_value";
+    cert_info->cert_info[i] = strdup(cert_value.c_str());
+    cert_info->cert_id[i] = i + 1;
+  }
+
+  return cert_info;
+}
\ No newline at end of file
index cfade92..eb7a925 100644 (file)
@@ -49,3 +49,5 @@ dependency_x *GetTestDepInfo(std::string pkgid);
 
 bool IsEqualDepInfo(const std::vector<dependency_x *>& depA,
     const std::vector<dependency_x *>& depB);
+
+pkgmgr_certinfo_x *GetTestCertificate();
\ No newline at end of file