equal
deleted
inserted
replaced
1 use Test::More; |
|
2 use Data::Dumper; |
|
3 use File::Temp; |
|
4 |
|
5 my $tmp = File::Temp->new; |
|
6 |
|
7 use_ok 'Joker::Result' or BAIL_OUT 'sorry'; |
|
8 use_ok 'Joker' or BAIL_OUT 'sorry'; |
|
9 can_ok 'Joker', qw(request); |
|
10 ok -f 'joker.conf' or BAIL_OUT 'joker.conf not found'; |
|
11 |
|
12 ok my %conf = do 'joker.conf' or BAIL_OUT 'config not valid'; |
|
13 |
|
14 subtest 'defaults' => sub { |
|
15 isa_ok my $joker = Joker->new(username => 'foo', password => 'bar'), |
|
16 'Joker'; |
|
17 is $joker->username, 'foo' => 'username'; |
|
18 is $joker->password, 'bar' => 'password'; |
|
19 is $joker->id_file, |
|
20 "$ENV{HOME}/.joker-auth-id" => 'default place of the auth id'; |
|
21 is $joker->uri, 'https://dmapi.ote.joker.com/request/' => 'default uri'; |
|
22 }; |
|
23 |
|
24 # now with a real config |
|
25 subtest 'real config' => sub { |
|
26 plan skip_all => 'no config' if not -f 'joker.conf'; |
|
27 isa_ok my $joker = Joker->new(%conf, id_file => "$tmp"), 'Joker'; |
|
28 is $joker->id_file, "$tmp", 'id file'; |
|
29 }; |
|
30 |
|
31 done_testing; |
|