Ed Tanous | 04e438c | 2020-10-03 08:06:26 -0700 | [diff] [blame^] | 1 | #include "utility.hpp" |
Jonathan Doman | 5beaf84 | 2020-08-14 11:23:33 -0700 | [diff] [blame] | 2 | |
| 3 | #include "gmock/gmock.h" |
| 4 | |
| 5 | TEST(Utility, Base64DecodeAuthString) |
| 6 | { |
| 7 | std::string authString("dXNlcm40bWU6cGFzc3cwcmQ="); |
| 8 | std::string result; |
| 9 | EXPECT_TRUE(crow::utility::base64Decode(authString, result)); |
| 10 | EXPECT_EQ(result, "usern4me:passw0rd"); |
| 11 | } |
| 12 | |
| 13 | TEST(Utility, Base64DecodeNonAscii) |
| 14 | { |
| 15 | std::string junkString("\xff\xee\xdd\xcc\x01\x11\x22\x33"); |
| 16 | std::string result; |
| 17 | EXPECT_FALSE(crow::utility::base64Decode(junkString, result)); |
| 18 | } |