1
0
mirror of https://github.com/falk-werner/webfused synced 2024-10-27 20:44:08 +00:00
falk-werner_webfused/test/mock/pam.hpp

46 lines
1.2 KiB
C++
Raw Normal View History

2020-03-19 20:53:49 +00:00
#ifndef WFD_MOCK_PAM_HPP
#define WFD_MOCK_PAM_HPP
#include <security/pam_appl.h>
#include <gmock/gmock.h>
namespace webfused_test
{
class IPam
{
public:
virtual ~IPam() = default;
2020-03-20 13:02:38 +00:00
virtual int pam_start(
2020-03-19 20:53:49 +00:00
char const * service_name,
char const * user,
struct pam_conv const * conversation,
pam_handle_t * * handle) = 0;
2020-03-20 13:02:38 +00:00
virtual int pam_end(pam_handle_t * handle, int status) = 0;
virtual int pam_authenticate(pam_handle_t * handle, int flags) = 0;
virtual int pam_acct_mgmt(pam_handle_t * handle, int flags) = 0;
virtual char const * pam_strerror(pam_handle_t * handle, int errnum) = 0;
2020-03-19 20:53:49 +00:00
};
class MockPam: public IPam
{
public:
MockPam();
~MockPam() override;
2020-03-20 13:02:38 +00:00
MOCK_METHOD4(pam_start, int (
2020-03-19 20:53:49 +00:00
char const * service_name,
char const * user,
struct pam_conv const * conversation,
pam_handle_t * * handle));
2020-03-20 13:02:38 +00:00
MOCK_METHOD2(pam_end, int(pam_handle_t * handle, int status));
MOCK_METHOD2(pam_authenticate, int(pam_handle_t * handle, int flags));
MOCK_METHOD2(pam_acct_mgmt, int (pam_handle_t * handle, int flags));
MOCK_METHOD2(pam_strerror, char const * (pam_handle_t * handle, int errnum));
2020-03-19 20:53:49 +00:00
};
}
#endif