Net-Fritz
view release on metacpan or search on metacpan
t/03.fritz-box.t view on Meta::CPAN
#!perl
use Test::More tests => 12;
use warnings;
use strict;
use Test::Mock::Simple;
use Test::Mock::LWP::Dispatch;
use HTTP::Response;
BEGIN { use_ok('Net::Fritz::Box') };
### public tests
subtest 'check new()' => sub {
# given
# when
my $box = new_ok( 'Net::Fritz::Box' );
# then
is( $box->error, '', 'Net::Fritz::Box->error' );
is( $box->upnp_url, 'https://fritz.box:49443', 'Net::Fritz::Box->upnp_url' );
is( $box->trdesc_path, '/tr64desc.xml', 'Net::Fritz::Box->trdesc_path' );
is( $box->username, undef, 'Net::Fritz::Box->username' );
is( $box->password, undef, 'Net::Fritz::Box->password' );
is( $box->configfile, undef, 'Net::Fritz::Box->configfile' );
};
subtest 'check new() with parameters' => sub {
# given
# when
my $box = new_ok( 'Net::Fritz::Box',
[ upnp_url => 'U1',
trdesc_path => 'T2',
username => 'U3',
password => 'P4'
]
);
# then
is( $box->error, '', 'Net::Fritz::Box->error' );
is( $box->upnp_url, 'U1', 'Net::Fritz::Box->upnp_url' );
is( $box->trdesc_path, 'T2', 'Net::Fritz::Box->trdesc_path' );
is( $box->username, 'U3', 'Net::Fritz::Box->username' );
is( $box->password, 'P4', 'Net::Fritz::Box->password' );
};
subtest 'new() reads from configfile' => sub {
# given
# when
my $box = new_ok( 'Net::Fritz::Box',
[ configfile => 't/config.file'
]
);
# then
is( $box->error, '', 'Net::Fritz::Box->error' );
is( $box->upnp_url, 'UPNP', 'Net::Fritz::Box->upnp_url' );
is( $box->trdesc_path, 'TRDESC', 'Net::Fritz::Box->trdesc_path' );
is( $box->username, 'USER', 'Net::Fritz::Box->username' );
is( $box->password, 'PASS', 'Net::Fritz::Box->password' );
is( $box->configfile, 't/config.file', 'Net::Fritz::Box->configfile' );
};
( run in 0.897 second using v1.01-cache-2.11-cpan-5511b514fd6 )