[BACK]Return to local_server.t CVS log [TXT][DIR] Up to [local] / HOPE / Net-OpenAMD / t

File: [local] / HOPE / Net-OpenAMD / t / local_server.t (download)

Revision 1.6, Sun Jun 27 03:45:07 2010 UTC (14 years ago) by andrew
Branch: MAIN
Changes since 1.5: +2 -2 lines

simplify the helper subs even more (although Perlcritic still hates them)
note that the base_url would prefer a / at the end to make the new way of using URI happy which makes Perlcritic happier.

#!perl
# $AFresh1: local_server.t,v 1.6 2010/06/27 03:45:07 andrew Exp $
use Test::More;    # tests => 75;

use strict;
use warnings;

use Net::OpenAMD;

BEGIN {
    use FindBin;
    use lib "$FindBin::Bin";
    use lib "$FindBin::Bin/../../mojo/lib";

    eval "use Test::Mojo::Server";
    plan skip_all => "Test::Mojo::Server required for testing local server"
        if $@;
    require 'network_tests.t';
}

my $server = Test::Mojo::Server->new();
$server->executable('test_server.pl');

my $path = $server->find_executable_ok('executable found');
my $port = $server->start_daemon_ok('daemon test');
$server->server_ok('server running');

my $amd = Net::OpenAMD->new(
    { base_url => 'http://127.0.0.1:' . $port . '/api/', } );
NetworkTests::run_tests($amd);

$server->stop_server_ok('server stopped');

done_testing();