API-MikroTik

 view release on metacpan or  search on metacpan

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

#!/usr/bin/env perl

use warnings;
use strict;

use lib './';

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;
use API::MikroTik::Response;
use API::MikroTik::Sentence;

t/mikrotik.t  view on Meta::CPAN


use warnings;
use strict;

BEGIN {
    $ENV{API_MIKROTIK_CONNTIMEOUT} = 0.5;
    $ENV{MOJO_NO_TLS}              = 1;
}

use FindBin;
use lib './';
use lib "$FindBin::Bin/lib";

use Test::More;

use API::MikroTik;
use API::MikroTik::Mockup;
use Mojo::IOLoop;
use Mojo::Util qw(steady_time);

# blocking
my $loop   = Mojo::IOLoop->new();

t/promises.t  view on Meta::CPAN


use warnings;
use strict;

BEGIN {
    $ENV{API_MIKROTIK_CONNTIMEOUT} = 0.5;
    $ENV{MOJO_NO_TLS}              = 1;
}

use FindBin;
use lib './';
use lib "$FindBin::Bin/lib";

use API::MikroTik;
use API::MikroTik::Mockup;
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();

t/query.t  view on Meta::CPAN

#!/usr/bin/env perl

use warnings;
use strict;

use lib './';

use Test::More;
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

#!/usr/bin/env perl

use warnings;
use strict;

use lib './';

use Test::More;
use API::MikroTik::Response;
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

#!/usr/bin/env perl

use warnings;
use strict;

use lib './';

use Test::More;
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.264 second using v1.01-cache-2.11-cpan-87723dcf8b7 )