|
|
|
@ -13,11 +13,12 @@ using ::webfused_test::MockSettings;
|
|
|
|
|
using ::webfused_test::MockCredentials;
|
|
|
|
|
using ::testing::Return;
|
|
|
|
|
using ::testing::StrEq;
|
|
|
|
|
using ::testing::_;
|
|
|
|
|
|
|
|
|
|
TEST(file_authenticator, create)
|
|
|
|
|
{
|
|
|
|
|
MockSettings settings;
|
|
|
|
|
EXPECT_CALL(settings, getString(StrEq("file"))).Times(1).WillOnce(Return("test_passwd.json"));
|
|
|
|
|
EXPECT_CALL(settings, wfd_settings_get_string(_,StrEq("file"))).Times(1).WillOnce(Return("test_passwd.json"));
|
|
|
|
|
|
|
|
|
|
wfd_authenticator authenticator;
|
|
|
|
|
bool success = wfd_file_authenticator_create(nullptr, &authenticator);
|
|
|
|
@ -29,7 +30,7 @@ TEST(file_authenticator, create)
|
|
|
|
|
TEST(file_authenticator, create_fail_missing_file)
|
|
|
|
|
{
|
|
|
|
|
MockSettings settings;
|
|
|
|
|
EXPECT_CALL(settings, getString(StrEq("file"))).Times(1).WillOnce(Return(nullptr));
|
|
|
|
|
EXPECT_CALL(settings, wfd_settings_get_string(_,StrEq("file"))).Times(1).WillOnce(Return(nullptr));
|
|
|
|
|
|
|
|
|
|
wfd_authenticator authenticator;
|
|
|
|
|
bool success = wfd_file_authenticator_create(nullptr, &authenticator);
|
|
|
|
@ -39,7 +40,7 @@ TEST(file_authenticator, create_fail_missing_file)
|
|
|
|
|
TEST(file_authenticator, create_via_factory)
|
|
|
|
|
{
|
|
|
|
|
MockSettings settings;
|
|
|
|
|
EXPECT_CALL(settings, getString(StrEq("file"))).Times(1).WillOnce(Return("test_passwd.json"));
|
|
|
|
|
EXPECT_CALL(settings, wfd_settings_get_string(_,StrEq("file"))).Times(1).WillOnce(Return("test_passwd.json"));
|
|
|
|
|
|
|
|
|
|
wfd_authenticator authenticator;
|
|
|
|
|
bool success = wfd_authenticator_create("file", nullptr, &authenticator);
|
|
|
|
@ -51,7 +52,7 @@ TEST(file_authenticator, create_via_factory)
|
|
|
|
|
TEST(file_authenticator, authenticate)
|
|
|
|
|
{
|
|
|
|
|
MockSettings settings;
|
|
|
|
|
EXPECT_CALL(settings, getString(StrEq("file"))).Times(1).WillOnce(Return("test_passwd.json"));
|
|
|
|
|
EXPECT_CALL(settings, wfd_settings_get_string(_,StrEq("file"))).Times(1).WillOnce(Return("test_passwd.json"));
|
|
|
|
|
|
|
|
|
|
wfd_authenticator authenticator;
|
|
|
|
|
bool success = wfd_file_authenticator_create(nullptr, &authenticator);
|
|
|
|
@ -70,7 +71,7 @@ TEST(file_authenticator, authenticate)
|
|
|
|
|
TEST(file_authenticator, authenticate_fail_wrong_passwd)
|
|
|
|
|
{
|
|
|
|
|
MockSettings settings;
|
|
|
|
|
EXPECT_CALL(settings, getString(StrEq("file"))).Times(1).WillOnce(Return("test_passwd.json"));
|
|
|
|
|
EXPECT_CALL(settings, wfd_settings_get_string(_,StrEq("file"))).Times(1).WillOnce(Return("test_passwd.json"));
|
|
|
|
|
|
|
|
|
|
wfd_authenticator authenticator;
|
|
|
|
|
bool success = wfd_file_authenticator_create(nullptr, &authenticator);
|
|
|
|
@ -89,7 +90,7 @@ TEST(file_authenticator, authenticate_fail_wrong_passwd)
|
|
|
|
|
TEST(file_authenticator, authenticate_fail_no_passwd_file)
|
|
|
|
|
{
|
|
|
|
|
MockSettings settings;
|
|
|
|
|
EXPECT_CALL(settings, getString(StrEq("file"))).Times(1).WillOnce(Return("unknown_passwd.json"));
|
|
|
|
|
EXPECT_CALL(settings, wfd_settings_get_string(_,StrEq("file"))).Times(1).WillOnce(Return("unknown_passwd.json"));
|
|
|
|
|
|
|
|
|
|
wfd_authenticator authenticator;
|
|
|
|
|
bool success = wfd_file_authenticator_create(nullptr, &authenticator);
|
|
|
|
@ -108,7 +109,7 @@ TEST(file_authenticator, authenticate_fail_no_passwd_file)
|
|
|
|
|
TEST(file_authenticator, authenticate_fail_missing_username)
|
|
|
|
|
{
|
|
|
|
|
MockSettings settings;
|
|
|
|
|
EXPECT_CALL(settings, getString(StrEq("file"))).Times(1).WillOnce(Return("test_passwd.json"));
|
|
|
|
|
EXPECT_CALL(settings, wfd_settings_get_string(_,StrEq("file"))).Times(1).WillOnce(Return("test_passwd.json"));
|
|
|
|
|
|
|
|
|
|
wfd_authenticator authenticator;
|
|
|
|
|
bool success = wfd_file_authenticator_create(nullptr, &authenticator);
|
|
|
|
@ -127,7 +128,7 @@ TEST(file_authenticator, authenticate_fail_missing_username)
|
|
|
|
|
TEST(file_authenticator, authenticate_fail_missing_password)
|
|
|
|
|
{
|
|
|
|
|
MockSettings settings;
|
|
|
|
|
EXPECT_CALL(settings, getString(StrEq("file"))).Times(1).WillOnce(Return("test_passwd.json"));
|
|
|
|
|
EXPECT_CALL(settings, wfd_settings_get_string(_,StrEq("file"))).Times(1).WillOnce(Return("test_passwd.json"));
|
|
|
|
|
|
|
|
|
|
wfd_authenticator authenticator;
|
|
|
|
|
bool success = wfd_file_authenticator_create(nullptr, &authenticator);
|
|
|
|
@ -146,7 +147,7 @@ TEST(file_authenticator, authenticate_fail_missing_password)
|
|
|
|
|
TEST(file_authenticator, get_type)
|
|
|
|
|
{
|
|
|
|
|
MockSettings settings;
|
|
|
|
|
EXPECT_CALL(settings, getString(StrEq("file"))).Times(1).WillOnce(Return("/any/path"));
|
|
|
|
|
EXPECT_CALL(settings, wfd_settings_get_string(_,StrEq("file"))).Times(1).WillOnce(Return("/any/path"));
|
|
|
|
|
|
|
|
|
|
wfd_authenticator authenticator;
|
|
|
|
|
bool success = wfd_file_authenticator_create(nullptr, &authenticator);
|
|
|
|
|