#include "utility.hpp" | |
#include "gmock/gmock.h" | |
TEST(Utility, Base64DecodeAuthString) | |
{ | |
std::string authString("dXNlcm40bWU6cGFzc3cwcmQ="); | |
std::string result; | |
EXPECT_TRUE(crow::utility::base64Decode(authString, result)); | |
EXPECT_EQ(result, "usern4me:passw0rd"); | |
} | |
TEST(Utility, Base64DecodeNonAscii) | |
{ | |
std::string junkString("\xff\xee\xdd\xcc\x01\x11\x22\x33"); | |
std::string result; | |
EXPECT_FALSE(crow::utility::base64Decode(junkString, result)); | |
} |