summaryrefslogtreecommitdiffstats
path: root/src/test/test-ask-password-api.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/test-ask-password-api.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/test/test-ask-password-api.c b/src/test/test-ask-password-api.c
index b24159e..e58e868 100644
--- a/src/test/test-ask-password-api.c
+++ b/src/test/test-ask-password-api.c
@@ -5,14 +5,19 @@
#include "tests.h"
TEST(ask_password) {
- int r;
_cleanup_strv_free_ char **ret = NULL;
+ int r;
+
+ static const AskPasswordRequest req = {
+ .message = "hello?",
+ .keyring = "da key",
+ };
- r = ask_password_tty(-1, "hello?", "da key", 0, ASK_PASSWORD_CONSOLE_COLOR, NULL, &ret);
+ r = ask_password_tty(-EBADF, &req, /* until= */ 0, /* flags= */ ASK_PASSWORD_CONSOLE_COLOR, /* flag_file= */ NULL, &ret);
if (r == -ECANCELED)
- assert_se(ret == NULL);
+ ASSERT_NULL(ret);
else {
- assert_se(r >= 0);
+ ASSERT_OK(r);
assert_se(strv_length(ret) == 1);
log_info("Got \"%s\"", *ret);
}