--- a/t/10-joker.t Wed Dec 24 21:47:20 2014 +0100
+++ b/t/10-joker.t Fri Sep 24 11:04:21 2021 +0200
@@ -1,5 +1,31 @@
use Test::More;
+use Data::Dumper;
+use File::Temp;
+
+my $tmp = File::Temp->new;
+
use_ok 'Joker::Result' or BAIL_OUT 'sorry';
-use_ok 'Joker' or BAIL_OUT 'sorry';
+use_ok 'Joker' or BAIL_OUT 'sorry';
+can_ok 'Joker', qw(request);
+ok -f 'joker.conf' or BAIL_OUT 'joker.conf not found';
+
+ok my %conf = do 'joker.conf' or BAIL_OUT 'config not valid';
+
+subtest 'defaults' => sub {
+ isa_ok my $joker = Joker->new(username => 'foo', password => 'bar'),
+ 'Joker';
+ is $joker->username, 'foo' => 'username';
+ is $joker->password, 'bar' => 'password';
+ is $joker->id_file,
+ "$ENV{HOME}/.joker-auth-id" => 'default place of the auth id';
+ is $joker->uri, 'https://dmapi.ote.joker.com/request/' => 'default uri';
+};
+
+# now with a real config
+subtest 'real config' => sub {
+ plan skip_all => 'no config' if not -f 'joker.conf';
+ isa_ok my $joker = Joker->new(%conf, id_file => "$tmp"), 'Joker';
+ is $joker->id_file, "$tmp", 'id file';
+};
done_testing;