-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3e422e3
commit cb96bf8
Showing
7 changed files
with
80 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// | ||
// Created by Jakub Szczerbinski on 05.11.24. | ||
// | ||
#include "lib/CredentialCache.hpp" | ||
#include "utils/test_setup.h" | ||
|
||
void test_credential_cache(void **unused) | ||
{ | ||
std::unique_ptr<sf::CredentialCache> cache{sf::CredentialCache::make()}; | ||
sf::CredentialKey key { "account", "host", "user", CredentialType::MFA_TOKEN }; | ||
|
||
std::string token = "example_token"; | ||
assert_true(cache->save(key, token)); | ||
assert_true(cache->get(key).value() == token); | ||
|
||
assert_true(cache->remove(key)); | ||
assert_false(cache->get(key).has_value()); | ||
} | ||
|
||
int main(void) { | ||
/* Testing only file based credential cache */ | ||
#ifndef __linux__ | ||
return 0; | ||
#endif | ||
const struct CMUnitTest tests[] = { | ||
cmocka_unit_test(test_credential_cache), | ||
}; | ||
return cmocka_run_group_tests(tests, NULL, NULL); | ||
} |