public ::testing::NiceMock<CynaraMock>,
public ::testing::NiceMock<GlibcMock> {};
+extern "C" int cynara_initialize(cynara** pp_cynara,
+ const cynara_configuration* p_conf) {
+ return CYNARA_API_SUCCESS;
+}
+
+extern "C" int cynara_finish(cynara* p_cynara) {
+ return CYNARA_API_SUCCESS;
+}
+
int fake_aul_app_get_appid_bypid(int pid, char* appid, int len) {
snprintf(appid, len, "%s", kAppId);
return AUL_R_OK;
}
TEST_F(AppInfoTest, app_info_foreach_category_P) {
- EXPECT_CALL(GetMock<CynaraMock>(), cynara_initialize(_, _))
- .WillOnce(
- Invoke([&](cynara** pp_cynara, const cynara_configuration* p_conf) {
- *pp_cynara = reinterpret_cast<cynara*>(&dummy);
- return CYNARA_API_SUCCESS;
- }));
EXPECT_CALL(GetMock<CynaraMock>(), cynara_check(_, _, _, _, _))
.WillOnce(Invoke(
[&](cynara* p_cynara, const char* client, const char* client_session,
const char* user, const char* privilege) {
return CYNARA_API_ACCESS_ALLOWED;
}));
- EXPECT_CALL(GetMock<CynaraMock>(), cynara_finish(_))
- .WillOnce(Invoke([&](cynara* p_cynara) { return CYNARA_API_SUCCESS; }));
EXPECT_CALL(GetMock<PkgmgrInfoMock>(),
pkgmgrinfo_appinfo_foreach_category(_, _, _))
.WillOnce(Invoke([&](pkgmgrinfo_appinfo_h handle,
#include "app-manager_unittests/mock/mock_hook.hh"
#include "app-manager_unittests/mock/test_fixture.hh"
-extern "C" int cynara_initialize(cynara** pp_cynara,
- const cynara_configuration* p_conf) {
- return MOCK_HOOK_P2(CynaraMock, cynara_initialize, pp_cynara, p_conf);
-}
-
extern "C" int cynara_check(cynara* p_cynara, const char* client,
const char* client_session, const char* user,
const char* privilege) {
return MOCK_HOOK_P5(CynaraMock, cynara_check, p_cynara, client,
client_session, user, privilege);
}
-
-extern "C" int cynara_finish(cynara* p_cynara) {
- return MOCK_HOOK_P1(CynaraMock, cynara_finish, p_cynara);
-}
public:
virtual ~CynaraMock() {}
- MOCK_METHOD2(cynara_initialize, int(cynara**, const cynara_configuration*));
MOCK_METHOD5(cynara_check, int(cynara*, const char*, const char*, const char*,
const char*));
- MOCK_METHOD1(cynara_finish, int(cynara*));
};
#endif // APP_MANAGER_UNITTESTS_MOCK_CYNARA_MOCK_HH_