summaryrefslogtreecommitdiff
path: root/t/lib/test_account.pl
blob: 38b282bd4115a9840904743055669480b3d29179 (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
sub test_account_or_skip {
    my $suffix = shift;
    my($login, $password) = test_account($suffix);

    unless( defined $login ) {
        plan skip_all => "No test account";
    }

    return($login, $password);
}

sub test_account {
    my $suffix = shift || '';
    $suffix = "_$suffix" if $suffix;
    open TEST_ACCOUNT, "t/test_account$suffix" or return;
    my($login, $password) = <TEST_ACCOUNT>;
    chomp $login;
    chomp $password;

    return($login, $password);
}

sub expiration_date {
    my($month, $year) = (localtime)[4,5];
    $year++;       # So we expire next year.
    $year %= 100;  # y2k?  What's that?

    return sprintf("%02d/%02d", $month, $year);
}

1;