auth:creds:tests: Add test for cli_credentials_get_username_and_obtained()
authorAndreas Schneider <asn@samba.org>
Tue, 1 Sep 2020 11:33:19 +0000 (13:33 +0200)
committerAndreas Schneider <asn@samba.org>
Wed, 2 Sep 2020 07:32:12 +0000 (09:32 +0200)
Signed-off-by: Andreas Schneider <asn@samba.org>
auth/credentials/tests/test_creds.c

index 396903a743ed7b12275b818e73d2ba89c576e1e2..4d23a1aec18af8b9d78af1471758d86593d5976b 100644 (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);