From c84953295a615da574aa1b42348a6f60105d5482 Mon Sep 17 00:00:00 2001
From: WangFengTu <wangfengtu@huawei.com>
Date: Tue, 24 Nov 2020 20:00:42 +0800
Subject: [PATCH 07/17] add mock conf_get_use_decrypted_key_flag and setup all
 common mocks

Signed-off-by: WangFengTu <wangfengtu@huawei.com>
---
 test/image/oci/registry/registry_ut.cc | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/test/image/oci/registry/registry_ut.cc b/test/image/oci/registry/registry_ut.cc
index 25ddf694..4b264424 100644
--- a/test/image/oci/registry/registry_ut.cc
+++ b/test/image/oci/registry/registry_ut.cc
@@ -73,6 +73,8 @@ std::string get_dir()
     return static_cast<std::string>(abs_path) +  "../../../../../test/image/oci/registry";
 }
 
+void mockCommonAll(MockStorage *mock, MockOciImage *oci_image_mock, MockIsuladConf *isulad_conf_mock);
+
 class RegistryUnitTest : public testing::Test {
 protected:
     void SetUp() override
@@ -81,6 +83,7 @@ protected:
         MockStorage_SetMock(&m_storage_mock);
         MockOciImage_SetMock(&m_oci_image_mock);
         MockIsuladConf_SetMock(&m_isulad_conf_mock);
+        mockCommonAll(&m_storage_mock, &m_oci_image_mock, &m_isulad_conf_mock);
     }
 
     void TearDown() override
@@ -507,6 +510,11 @@ static char *invokeConfGetISuladRootDir()
     return util_strdup_s(get_dir().c_str());
 }
 
+static bool invokeConfGetUseDecryptedKeyFlag()
+{
+    return true;
+}
+
 void mockCommonAll(MockStorage *mock, MockOciImage *oci_image_mock, MockIsuladConf *isulad_conf_mock)
 {
     EXPECT_CALL(*mock, StorageImgCreate(::testing::_, ::testing::_, ::testing::_, ::testing::_))
@@ -543,6 +551,8 @@ void mockCommonAll(MockStorage *mock, MockOciImage *oci_image_mock, MockIsuladCo
     .WillRepeatedly(Invoke(invokeOciValidTime));
     EXPECT_CALL(*isulad_conf_mock, ConfGetISuladRootDir())
     .WillRepeatedly(Invoke(invokeConfGetISuladRootDir));
+    EXPECT_CALL(*isulad_conf_mock, ConfGetUseDecryptedKeyFlag())
+    .WillRepeatedly(Invoke(invokeConfGetUseDecryptedKeyFlag));
     return;
 }
 
-- 
2.25.1

