diff options
| author | Aotrix <[email protected]> | 2025-11-05 20:02:41 +0100 |
|---|---|---|
| committer | Aotrix <[email protected]> | 2025-11-05 20:02:41 +0100 |
| commit | e3ebaab014e1fde5ed98dbd4566036de1c3819a4 (patch) | |
| tree | b8011c729b6e933e962d16db649b328f6bc341a7 /subprojects/battleNetApi/tests | |
| parent | 5d8444d27ce49bfaf65e11200348e132c3cb4ec4 (diff) | |
refactored code
Diffstat (limited to 'subprojects/battleNetApi/tests')
| -rw-r--r-- | subprojects/battleNetApi/tests/tests.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/subprojects/battleNetApi/tests/tests.cpp b/subprojects/battleNetApi/tests/tests.cpp index f55b346..38e82e5 100644 --- a/subprojects/battleNetApi/tests/tests.cpp +++ b/subprojects/battleNetApi/tests/tests.cpp @@ -2,20 +2,22 @@ #include <catch2/catch_test_macros.hpp> #include <iostream> -class TokenTests { +class TokenMock { public: - std::string toString() const { - const std::string kTokenFilePath{"resources/token_info"}; - const std::string kUsername{"2b50f1123b424d5e9c21971a110fdd04"}; - const std::string kPassword{"MrMkhVMNdOeqPL4Q4XVQAsRPR14J7Yq6"}; - const Token aToken(kTokenFilePath, kUsername, kPassword); - return aToken.toString(); - } + std::string toString() const { return mToken.toString(); } + TokenMock(const std::string &iTokenFilePath, const std::string &iUsername, const std::string &iPassword) + : mToken{iTokenFilePath, iUsername, iPassword} {} + + private: + const Token mToken; }; TEST_CASE("API Token retrieval", "[getApiToken]") { - TokenTests aToken; - const std::string kToken{aToken.toString()}; - std::cout << kToken << '\n'; - REQUIRE(not kToken.empty()); + const std::string kTokenFilePath{"resources/token_info"}; + const std::string kUsername{"2b50f1123b424d5e9c21971a110fdd04"}; + const std::string kPassword{"MrMkhVMNdOeqPL4Q4XVQAsRPR14J7Yq6"}; + TokenMock aToken{kTokenFilePath, kUsername, kPassword}; + const std::string kTokenContent{aToken.toString()}; + std::cout << kTokenContent << '\n'; + REQUIRE(not kTokenContent.empty()); } |
