encoded_auth_tests.cpp 492 B

1234567891011121314151617181920
  1. #include <gtest/gtest.h>
  2. #include <string>
  3. #include <cpr/cpr.h>
  4. using namespace cpr;
  5. TEST(EncodedAuthenticationTests, UnicodeEncoderTest) {
  6. std::string user = "一二三";
  7. std::string pass = "Hello World!";
  8. EncodedAuthentication pa{user, pass};
  9. std::string expected = "%E4%B8%80%E4%BA%8C%E4%B8%89:Hello%20World%21";
  10. EXPECT_EQ(pa.GetAuthString(), expected);
  11. }
  12. int main(int argc, char** argv) {
  13. ::testing::InitGoogleTest(&argc, argv);
  14. return RUN_ALL_TESTS();
  15. }