auth:creds:tests: Add test for cli_credentials_get_password_and_obtained()
authorAndreas Schneider <asn@samba.org>
Tue, 1 Sep 2020 13:36:20 +0000 (15:36 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 28 Apr 2021 03:43:34 +0000 (03:43 +0000)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
auth/credentials/tests/test_creds.c

index d7185c6734a88e33f2eeafd6cd32b34320b9cc6e..0f482e38eaa522fc80b3d0985867f135971ef23c 100644 (file)
@@ -49,6 +49,7 @@ static void torture_creds_init(void **state)
        const char *domain = NULL;
        const char *password = NULL;
        enum credentials_obtained usr_obtained = CRED_UNINITIALISED;
+       enum credentials_obtained pwd_obtained = CRED_UNINITIALISED;
        bool ok;
 
        creds = cli_credentials_init(mem_ctx);
@@ -85,6 +86,11 @@ static void torture_creds_init(void **state)
        password = cli_credentials_get_password(creds);
        assert_string_equal(password, "SECRET");
 
+       password = cli_credentials_get_password_and_obtained(creds,
+                                                            &pwd_obtained);
+       assert_int_equal(pwd_obtained, CRED_SPECIFIED);
+       assert_string_equal(password, "SECRET");
+
        /* Run dump to check it works */
        cli_credentials_dump(creds);
 }