#! /usr/bin/perl -Idebian/tests/lib


use diagnostics;
use strict;
use warnings;

use AdduserTestsCommon;
use Test::More;

my $name="ausskel";

END {
    cleanup_home_directory_tests();
    cleanup_user($name);
    done_testing();
}
my $homedir_contents = initialize_home_directory_tests();

assert_user_does_not_exist($name);
assert_command_success(
    '/usr/sbin/adduser',
    '--stdoutmsglevel=error', '--stderrmsglevel=error',
    '--comment','""',
    '--disabled-password',
    $name
);
assert_user_exists($name);
assert_user_has_home_directory($name,"/home/$name");
assert_path_is_a_directory("/home/$name");
assert_user_home_directory_content($name, "/home/$name", $homedir_contents);

$name="ausskelforcehome";
mkdir("/home/$name", 0777);
assert_path_is_a_directory("/home/$name");
# root:root 777
assert_user_does_not_exist($name);
assert_command_success(
    '/usr/sbin/adduser',
    '--stdoutmsglevel=error', '--stderrmsglevel=error',
    '--comment','""',
    '--force-home',
    '--disabled-password',
    $name
);
assert_user_exists($name);
assert_user_has_home_directory($name,"/home/$name");
assert_path_is_a_directory("/home/$name");
assert_user_home_directory_content($name, "/home/$name", $homedir_contents);
# done_testing(); done in END

# vim: tabstop=4 shiftwidth=4 expandtab
