aboutsummaryrefslogtreecommitdiffstats
path: root/t/02-Users.t
blob: 1feb6ad7fca3d59e018358f0c239cad8ad3a0b01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use 5.006;
use strict;
use warnings FATAL => 'all';
use Test::More;

BEGIN {
    use_ok( 'ManaTools::Shared::Users' ) || print "Users failed!\n";
}

    ok( my $o = ManaTools::Shared::Users->new({user_face_dir => '/tmp'}), 'create');
    ok( my $facedir = $o->facedir(), 'facedir' );
    diag "facedir got: < " . $facedir . " >";
    ok( my $userfacedir = $o->userfacedir(), 'userfacedir' );
    diag "userfacedir got: < " . $userfacedir . " >";
    ok( my $ipathname = $o->face2png('username'), 'face2png' );
    diag "face2png for user \'username\' got: < " . $ipathname . " >";
    ok( my $facenames = $o->facenames(), 'facenames' );
    diag "facenames got: < " . scalar(@$facenames) . " elements >";
    ok( $o->addKdmIcon('username', $facenames->[0]), 'addKdmIcon' );

    ok( my ($val, $str) = $o->valid_username('username'), 'valid_username' );
    diag "valid_username(username) got: < " . $str . " >";
    ok(($val, $str) = $o->valid_username('3D-user'), 'not_valid_username');
    diag "valid_username(3D-user) got: < " . $str . " >";
    ok( ($val, $str) = $o->valid_groupname('groupname'), 'valid_groupname' );
    diag "valid_groupname(groupname) got: < " . $str . " >";
    ok(($val, $str) = $o->valid_groupname('g1234567890123456'), 'not_valid_groupname');
    diag "valid_groupname(g1234567890123456) got: < " . $str . " >";
    ok( my $face = $o->GetFaceIcon('username', 1), 'GetFaceIcon' );
    diag "GetFaceIcon after '" . $facenames->[0] . "' got: < ". $face ." >";
    ok( $o->strongPassword('S0meWh3r3'), 'strongPassword' );

    ok( $o->removeKdmIcon('username'), 'removeKdmIcon' );


done_testing;