Annotation of HOPE/Net-OpenAMD/t/local_server.t, Revision 1.10
1.1 andrew 1: #!perl
1.10 ! andrew 2: # $AFresh1: local_server.t,v 1.9 2010/06/28 20:40:38 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";
18: }
19: else {
20: plan tests => 15;
21: }
1.4 andrew 22: require 'network_tests.t';
1.1 andrew 23: }
24:
1.10 ! andrew 25: my %tests = (
! 26: location => [
! 27: { args => undef,
! 28: expect => [
! 29: { 'y' => '83.1452331542969',
! 30: 'area' => 'Engressia',
! 31: 'time' => 2387,
! 32: 'user' => 12983,
! 33: 'x' => '46.7369918823242',
! 34: 'button' => 'False'
! 35: }
! 36: ],
! 37: },
! 38: ],
! 39: speakers => [
! 40: { args => undef,
! 41: expect => [
! 42: { 'name' => 'Johnny',
! 43: 'bio' => 'Johnny\'s bio'
! 44: },
! 45: ],
! 46: },
! 47: ],
! 48: talks => [
! 49: { args => undef,
! 50: expect => [
! 51: { 'speakers' => [ 'Judas', 'JohnnyX' ],
! 52: 'interests' => [ 'media', 'crypto' ],
! 53: 'time' => '2008/7/18 13:00:00',
! 54: 'track' => 'Hooper',
! 55: 'title' => 'Ancient Egyptian Music and DRM',
! 56: 'abstract' =>
! 57: '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.'
! 58: }
! 59: ],
! 60: },
! 61: ],
! 62: interests => [
! 63: { args => undef,
! 64: expect => [
! 65: 'new tech', 'activism',
! 66: 'radio', 'lockpicking',
! 67: 'crypto', 'privacy',
! 68: 'ethics', 'telephones',
! 69: 'social engineering', 'hacker spaces',
! 70: 'hardware hacking', 'nostalgia',
! 71: 'communities', 'science',
! 72: 'government', 'network security',
! 73: 'malicious software', 'pen testing',
! 74: 'web', 'niche hacks',
! 75: 'media',
! 76: ],
! 77: },
! 78: ],
! 79: users => [
! 80: { args => undef,
! 81: expect => [
! 82: { 'name' => 'JohnnyX',
! 83: 'x' => '32.54091324',
! 84: 'y' => '54.10958384',
! 85: 'interests' => [
! 86: 'new tech', 'radio',
! 87: 'lockpicking', 'crypto',
! 88: 'telephones', 'social engineering',
! 89: 'hacker spaces', 'hardware hacking',
! 90: 'nostalgia', 'communities',
! 91: 'science', 'network security',
! 92: 'malicious software', 'pen testing'
! 93: ],
! 94: }
! 95: ]
! 96: },
! 97: ],
! 98: stats => [
! 99: { args => undef,
! 100: expect => qr/^Unused \s feature/xms,
! 101: },
! 102: ],
! 103: );
! 104:
1.1 andrew 105: my $server = Test::Mojo::Server->new();
106: $server->executable('test_server.pl');
107:
108: my $path = $server->find_executable_ok('executable found');
109: my $port = $server->start_daemon_ok('daemon test');
110: $server->server_ok('server running');
111:
1.5 andrew 112: my $amd = Net::OpenAMD->new(
1.7 andrew 113: { base_uri => 'http://127.0.0.1:' . $port . '/api/', } );
1.10 ! andrew 114: NetworkTests::run_tests( $amd, \%tests );
1.1 andrew 115:
1.5 andrew 116: $server->stop_server_ok('server stopped');
1.1 andrew 117:
1.8 andrew 118: #done_testing();
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>