os-autoinst-distri-fedora/tests/applications/keyring/aaa_setup.pm

88 lines
2.7 KiB
Perl

use base "installedtest";
use strict;
use testapi;
use utils;
# This script will install the necessary things to test the Desktop Keyring on Gnome
# and KDE, i.e.:
# - we will install an FTP server.
# - we will set it up so that logins can be made.
# - we will log into the FTP server and make the system to remember the credentials.
# - we will restart the machine and check that the credentials are still remembered.
# - we will open SeaHorse or KDE Wallet to check that the credentials are stored.
sub run {
my $self = shift;
# Switch to console
$self->root_console(tty => 3);
# We install the FTP server's package.
assert_script_run("dnf -y install pure-ftpd");
# Download the configuration file for FTP and unpack it.
download_testdata("configuration");
assert_script_run("mv -f /home/test/configuration/pure-ftpd.conf /etc/pure-ftpd/");
assert_script_run("chown root:root /etc/pure-ftpd/pure-ftpd.conf");
assert_script_run("chmod 644 /etc/pure-ftpd/pure-ftpd.conf");
# Set up the system.
assert_script_run("groupadd ftpusers");
assert_script_run("useradd -g ftpusers -d /dev/null -s /sbin/nologin ftpuser");
assert_script_run("mkdir /ftpdata");
assert_script_run("chown -R ftpuser:ftpusers /ftpdata");
assert_script_run("echo 'This is a test file' > /ftpdata/testfile.txt");
assert_script_run("firewall-cmd --add-service=ftp --permanent");
assert_script_run("firewall-cmd --reload");
# Set up the FTP server.
enter_cmd("pure-pw useradd tucnak -u ftpuser -g ftpusers -d /ftpdata");
sleep(2);
type_string("weakpassword\n"); # To pass the password entry.
sleep(2);
type_string("weakpassword\n");
sleep(2);
# Create the database.
assert_script_run("pure-pw mkdb");
# Check that the settings are done correctly
assert_script_run("pure-pw list | egrep 'tucnak\\s+/ftpdata'");
assert_script_run("pure-pw show tucnak");
# Enable and start the server.
assert_script_run("systemctl enable pure-ftpd.service --now");
# Check that it is running (the assertion will fail if not)
assert_script_run("systemctl status pure-ftpd.service --no-pager");
# Return to desktop
desktop_vt();
# Start the file explorer application.
my $app = "nautilus";
my $key = "up";
if (get_var("DESKTOP") eq "kde") {
$app = "dolphin";
$key = "pgup";
}
menu_launch_type($app);
send_key("super-$key");
wait_still_screen(3);
# Check that it has started
if (get_var("DESKTOP") eq "kde") {
assert_screen("dolphin_runs");
}
else {
assert_screen("apps_run_files");
}
}
sub test_flags {
return {fatal => 1, milestone => 1};
}
1;
# vim: set sw=4 et: