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

Annotation of HOPE/Net-OpenAMD/t/local_server.t, Revision 1.11

1.1       andrew      1: #!perl
1.11    ! andrew      2: # $AFresh1: local_server.t,v 1.10 2010/06/30 05:30:17 andrew Exp $
1.9       andrew      3: use Test::More;
1.1       andrew      4:
                      5: use strict;
                      6: use warnings;
                      7:
1.4       andrew      8: use Net::OpenAMD;
1.1       andrew      9:
                     10: BEGIN {
1.2       andrew     11:     use FindBin;
1.4       andrew     12:     use lib "$FindBin::Bin";
                     13:     use lib "$FindBin::Bin/../../mojo/lib";
1.2       andrew     14:
1.1       andrew     15:     eval "use Test::Mojo::Server";
1.9       andrew     16:     if ($@) {
                     17:         plan skip_all => "Test::Mojo::Server required for testing local server";
1.11    ! andrew     18:     }
        !            19:     elsif ($] < 5.01) {
        !            20:         plan skip_all => 'test_server.pl requires perl 5.10 or higher';
1.9       andrew     21:     }
                     22:     else {
                     23:         plan tests => 15;
                     24:     }
1.4       andrew     25:     require 'network_tests.t';
1.1       andrew     26: }
                     27:
1.10      andrew     28: my %tests = (
                     29:     location => [
                     30:         {   args   => undef,
                     31:             expect => [
                     32:                 {   'y'      => '83.1452331542969',
                     33:                     'area'   => 'Engressia',
                     34:                     'time'   => 2387,
                     35:                     'user'   => 12983,
                     36:                     'x'      => '46.7369918823242',
                     37:                     'button' => 'False'
                     38:                 }
                     39:             ],
                     40:         },
                     41:     ],
                     42:     speakers => [
                     43:         {   args   => undef,
                     44:             expect => [
                     45:                 {   'name' => 'Johnny',
                     46:                     'bio'  => 'Johnny\'s bio'
                     47:                 },
                     48:             ],
                     49:         },
                     50:     ],
                     51:     talks => [
                     52:         {   args   => undef,
                     53:             expect => [
                     54:                 {   'speakers'  => [ 'Judas', 'JohnnyX' ],
                     55:                     'interests' => [ 'media', 'crypto' ],
                     56:                     'time'      => '2008/7/18 13:00:00',
                     57:                     'track'     => 'Hooper',
                     58:                     'title' => 'Ancient Egyptian Music and DRM',
                     59:                     'abstract' =>
                     60:                         'A discussion of the development of musical notation, which was designed as a means of reproducing music while making it impossible for the general public to perform without permission.'
                     61:                 }
                     62:             ],
                     63:         },
                     64:     ],
                     65:     interests => [
                     66:         {   args   => undef,
                     67:             expect => [
                     68:                 'new tech',           'activism',
                     69:                 'radio',              'lockpicking',
                     70:                 'crypto',             'privacy',
                     71:                 'ethics',             'telephones',
                     72:                 'social engineering', 'hacker spaces',
                     73:                 'hardware hacking',   'nostalgia',
                     74:                 'communities',        'science',
                     75:                 'government',         'network security',
                     76:                 'malicious software', 'pen testing',
                     77:                 'web',                'niche hacks',
                     78:                 'media',
                     79:             ],
                     80:         },
                     81:     ],
                     82:     users => [
                     83:         {   args   => undef,
                     84:             expect => [
                     85:                 {   'name'      => 'JohnnyX',
                     86:                     'x'         => '32.54091324',
                     87:                     'y'         => '54.10958384',
                     88:                     'interests' => [
                     89:                         'new tech',           'radio',
                     90:                         'lockpicking',        'crypto',
                     91:                         'telephones',         'social engineering',
                     92:                         'hacker spaces',      'hardware hacking',
                     93:                         'nostalgia',          'communities',
                     94:                         'science',            'network security',
                     95:                         'malicious software', 'pen testing'
                     96:                     ],
                     97:                 }
                     98:             ]
                     99:         },
                    100:     ],
                    101:     stats => [
                    102:         {   args   => undef,
                    103:             expect => qr/^Unused \s feature/xms,
                    104:         },
                    105:     ],
                    106: );
                    107:
1.1       andrew    108: my $server = Test::Mojo::Server->new();
                    109: $server->executable('test_server.pl');
                    110:
                    111: my $path = $server->find_executable_ok('executable found');
                    112: my $port = $server->start_daemon_ok('daemon test');
                    113: $server->server_ok('server running');
                    114:
1.5       andrew    115: my $amd = Net::OpenAMD->new(
1.7       andrew    116:     { base_uri => 'http://127.0.0.1:' . $port . '/api/', } );
1.10      andrew    117: NetworkTests::run_tests( $amd, \%tests );
1.1       andrew    118:
1.5       andrew    119: $server->stop_server_ok('server stopped');
1.1       andrew    120:
1.8       andrew    121: #done_testing();

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>