API-MikroTik

 view release on metacpan or  search on metacpan

t/mikrotik-online.t  view on Meta::CPAN

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env perl
 
use strict;
 
use lib './';
 
 
plan skip_all =>
    'On-line tests. Set API_MIKROTIK_ONLINE to "host:user:pass:tls" to run.'
    unless $ENV{API_MIKROTIK_ONLINE};
 

t/mikrotik.t  view on Meta::CPAN

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use strict;
 
BEGIN {
    $ENV{API_MIKROTIK_CONNTIMEOUT} = 0.5;
    $ENV{MOJO_NO_TLS}              = 1;
}
 
use FindBin;
use lib './';
use lib "$FindBin::Bin/lib";
 
 
use Mojo::Util qw(steady_time);
 
# blocking
my $loop   = Mojo::IOLoop->new();

t/promises.t  view on Meta::CPAN

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use strict;
 
BEGIN {
    $ENV{API_MIKROTIK_CONNTIMEOUT} = 0.5;
    $ENV{MOJO_NO_TLS}              = 1;
}
 
use FindBin;
use lib './';
use lib "$FindBin::Bin/lib";
 
 
plan skip_all => 'Mojolicious v7.54+ required for this test.'
    unless API::MikroTik->PROMISES;
 
my $mockup = API::MikroTik::Mockup->new();

t/query.t  view on Meta::CPAN

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/env perl
 
use strict;
 
use lib './';
 
use API::MikroTik::Query 'build_query';
 
my $r = build_query({a => 1, b => 2, c => 3, d => 4});
is_deeply $r, ['?a=1', '?b=2', '?c=3', '?d=4', '?#&&&'], 'simple AND';
 
$r = build_query([a => 1, b => 2, c => 3]);
is_deeply $r, ['?a=1', '?b=2', '?c=3', '?#||'], 'simple OR';

t/response.t  view on Meta::CPAN

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env perl
 
use strict;
 
use lib './';
 
use API::MikroTik::Sentence qw(encode_sentence);
 
my $r = API::MikroTik::Response->new();
 
my $packed = encode_sentence('!re', {a => 1, b => 2});
$packed .= encode_sentence('!re', {c => 3, d => 4, e => 5}, undef, 3);
$packed .= encode_sentence('!done');

t/sentence.t  view on Meta::CPAN

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env perl
 
use strict;
 
use lib './';
 
use API::MikroTik::Sentence qw(encode_sentence);
 
my $s = API::MikroTik::Sentence->new();
 
# length encoding
my ($packed, $len);
for (0x7f, 0x3fff, 0x1fffff, 0xfffffff, 0x10000000) {
    $packed = API::MikroTik::Sentence::_encode_length($_);



( run in 0.380 second using v1.01-cache-2.11-cpan-4e96b696675 )