Commit 81933406 authored by Bastien Nocera's avatar Bastien Nocera Committed by Daniel Drake
Browse files

Support setting the username in the tests

Allow enroll and verify to optionally set a username. Makes
testing easier.
parent 2f5987ed
......@@ -158,6 +158,16 @@ static void release_device(DBusGProxy *dev)
g_error("ReleaseDevice failed: %s", error->message);
}
static gboolean set_username(DBusGProxy *dev, const char *username)
{
GError *error = NULL;
if (!net_reactivated_Fprint_Device_set_username(dev, username, &error)) {
g_error("SetUsename failed: %s", error->message);
return FALSE;
}
return TRUE;
}
int main(int argc, char **argv)
{
GMainLoop *loop;
......@@ -168,6 +178,10 @@ int main(int argc, char **argv)
create_manager();
dev = open_device();
if (argc == 2) {
if (set_username(dev, argv[1]) == FALSE)
return 1;
}
do_enroll(dev);
release_device(dev);
return 0;
......
......@@ -211,6 +211,16 @@ static void release_device(DBusGProxy *dev)
g_error("ReleaseDevice failed: %s", error->message);
}
static gboolean set_username(DBusGProxy *dev, const char *username)
{
GError *error = NULL;
if (!net_reactivated_Fprint_Device_set_username(dev, username, &error)) {
g_error("SetUsename failed: %s", error->message);
return FALSE;
}
return TRUE;
}
int main(int argc, char **argv)
{
GMainLoop *loop;
......@@ -222,6 +232,10 @@ int main(int argc, char **argv)
create_manager();
dev = open_device();
if (argc == 2) {
if (set_username(dev, argv[1]) == FALSE)
return 1;
}
finger_num = find_finger(dev);
do_verify(dev, finger_num);
release_device(dev);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment