API-MikroTik
view release on metacpan or search on metacpan
t/mikrotik-online.t view on Meta::CPAN
12345678910111213141516#!/usr/bin/env perl
use
warnings;
use
strict;
use
Test::More;
plan
skip_all
=>
'On-line tests. Set API_MIKROTIK_ONLINE to "host:user:pass:tls" to run.'
unless
$ENV
{API_MIKROTIK_ONLINE};
use
API::MikroTik;
t/mikrotik.t view on Meta::CPAN
234567891011121314151617181920212223use
warnings;
use
strict;
BEGIN {
$ENV
{API_MIKROTIK_CONNTIMEOUT} = 0.5;
$ENV
{MOJO_NO_TLS} = 1;
}
use
FindBin;
use
Test::More;
use
API::MikroTik;
use
Mojo::IOLoop;
# blocking
my
$loop
= Mojo::IOLoop->new();
t/promises.t view on Meta::CPAN
234567891011121314151617181920212223use
warnings;
use
strict;
BEGIN {
$ENV
{API_MIKROTIK_CONNTIMEOUT} = 0.5;
$ENV
{MOJO_NO_TLS} = 1;
}
use
FindBin;
use
API::MikroTik;
use
Mojo::IOLoop;
use
Test::More;
plan
skip_all
=>
'Mojolicious v7.54+ required for this test.'
unless
API::MikroTik->PROMISES;
my
$mockup
= API::MikroTik::Mockup->new();
123456789101112131415#!/usr/bin/env perl
use
warnings;
use
strict;
use
Test::More;
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
12345678910111213141516#!/usr/bin/env perl
use
warnings;
use
strict;
use
Test::More;
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
12345678910111213141516#!/usr/bin/env perl
use
warnings;
use
strict;
use
Test::More;
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 )