summaryrefslogtreecommitdiff
path: root/t/lib/test_account.pl
blob: b4fa60348c864464d1e67931637fdaf3a2eb7b1f (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
use Test::More;

sub test_account_or_skip {
    my($login, $password) = test_account();

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

    return($login, $password);
}

sub test_account {
    open TEST_ACCOUNT, "t/test_account" or return;
    my($login, $password, $hostport) = <TEST_ACCOUNT>;
    chomp $login;
    chomp $password;
    chomp $hostport;

    if ( $hostport =~ /^\s*([\w\.]+)(:(\d+))?\s*$/ ) {
      my($host, $port) = ($1, $3);
      $Net::GlobalPOPs::MediaServicesAPI::HOST = $host;
      $Net::GlobalPOPs::MediaServicesAPI::PORT = $port;
    }

    return($login, $password);
}

1;