1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

auth:creds:tests: Add test for cli_credentials_get_username_and_obtained()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Andreas Schneider 2020-09-01 13:33:19 +02:00 committed by Andrew Bartlett
parent f33844b70b
commit 3b78f4f093

View File

@ -48,6 +48,7 @@ static void torture_creds_init(void **state)
const char *username = NULL;
const char *domain = NULL;
const char *password = NULL;
enum credentials_obtained usr_obtained = CRED_UNINITIALISED;
bool ok;
creds = cli_credentials_init(mem_ctx);
@ -71,6 +72,11 @@ static void torture_creds_init(void **state)
username = cli_credentials_get_username(creds);
assert_string_equal(username, "brot");
username = cli_credentials_get_username_and_obtained(creds,
&usr_obtained);
assert_int_equal(usr_obtained, CRED_SPECIFIED);
assert_string_equal(username, "brot");
password = cli_credentials_get_password(creds);
assert_null(password);
ok = cli_credentials_set_password(creds, "SECRET", CRED_SPECIFIED);