view release on metacpan or search on metacpan
}
},
"test" : {
"requires" : {
"Catalyst::Test" : "0",
"HTTP::Request::Common" : "0",
"Test::Lib" : "0",
"Test::Most" : "0.34"
}
}
},
view all matches for this distribution
view release on metacpan or search on metacpan
}
},
"test" : {
"requires" : {
"Catalyst::Test" : "0",
"HTTP::Request::Common" : "0",
"Test::Lib" : "0",
"Test::Most" : "0.34"
}
}
},
view all matches for this distribution
view release on metacpan or search on metacpan
t/01_server.t view on Meta::CPAN
no warnings 'redefine';
if ( $Catalyst::VERSION < 5.89 ) {
*Catalyst::Test::local_request = sub {
my ( $class, $request ) = @_;
require HTTP::Request::AsCGI;
my $cgi = HTTP::Request::AsCGI->new( $request, %ENV )->setup;
$class->handle_request;
return $cgi->restore->response;
};
t/01_server.t view on Meta::CPAN
}
my $entrypoint = "http://localhost/foo";
{
my $request = HTTP::Request->new( GET => $entrypoint );
ok( my $response = request($request), 'Request' );
ok( $response->is_success, 'Response Successful 2xx' );
is( $response->code, 200, 'Response Code' );
is_deeply( [ $response->content_type ], [ 'application/json', 'charset=utf-8' ] );
t/01_server.t view on Meta::CPAN
is_deeply $data->{json_baz}, [ 1, 2, 3 ];
ok ! $data->{foo}, "doesn't return stash that doesn't match json_";
}
{
my $request = HTTP::Request->new( GET => "http://localhost/foo2" );
ok( my $response = request($request), 'Request' );
ok( $response->is_success, 'Response Successful 2xx' );
is( $response->code, 200, 'Response Code' );
is_deeply( [ $response->content_type ], [ 'application/json', 'charset=utf-8' ] );
t/01_server.t view on Meta::CPAN
my $data = from_json($response->content);
is_deeply( $data, [1, 2, 3] );
}
{
my $request = HTTP::Request->new( GET => $entrypoint . "?cb=foobar" );
ok( my $response = request($request), 'Request' );
ok( $response->is_success, 'Response Successful 2xx' );
is( $response->code, 200, 'Response Code' );
is_deeply( [ $response->content_type ], [ 'application/json', 'charset=utf-8' ] );
t/01_server.t view on Meta::CPAN
is_deeply $data->{json_baz}, [ 1, 2, 3 ];
ok ! $data->{foo}, "doesn't return stash that doesn't match json_";
}
{
my $request = HTTP::Request->new( GET => $entrypoint . "?cb=foobar%28" );
ok( my $response = request($request), 'Request' );
like $response->header('X-Error'), qr/Invalid callback parameter/,;
}
{
##
my $request = HTTP::Request->new( GET => "http://localhost/foo3" );
ok( my $response = request($request), 'Request' );
is_deeply( [ $response->content_type ], [ 'application/json', 'charset=utf-8' ] );
ok decode('utf-8', $response->content);
}
{
my $request = HTTP::Request->new( GET => "http://localhost/foo4" );
ok( my $response = request($request), 'Request' );
is_deeply( [ $response->content_type ], [ 'application/json', 'charset=euc-jp' ] );
ok decode('euc-jp', $response->content);
}
{
my $request = HTTP::Request->new( GET => "http://localhost/foo3" );
$request->header("User-Agent", "Safari");
ok( my $response = request($request), 'Request' );
is_deeply( [ $response->content_type ], [ 'application/json', 'charset=utf-8' ] );
my $bom = substr $response->content, 0, 3;
is $bom, "\xEF\xBB\xBF";
}
{
my $request = HTTP::Request->new( GET => "http://localhost/foo3" );
$request->header("User-Agent", "Safari");
ok( my $response = request($request), 'Request' );
is_deeply( [ $response->content_type ], [ 'application/json', 'charset=utf-8' ] );
my $bom = substr $response->content, 0, 3;
is $bom, "\xEF\xBB\xBF";
}
{
my $request = HTTP::Request->new( GET => "http://localhost/foo3" );
$request->header("X-Prototype-Version", "1.5");
ok( my $response = request($request), 'Request' );
ok $response->header('X-JSON');
}
{
my $request = HTTP::Request->new( GET => "http://localhost/foo5" );
$request->header("X-Prototype-Version", "1.5");
ok( my $response = request($request), 'Request' );
ok !$response->header('X-JSON');
}
{
my $request = HTTP::Request->new( GET => "http://localhost/foo6" );
ok( my $response = request($request), 'Request' );
my $data = from_json($response->content);
is $data->{foo}, "fake";
}
{
my $request = HTTP::Request->new( GET => "http://localhost/warnmsg" );
ok( my $response = request($request), 'Request' );
ok( $response->is_success, 'Response Successful 2xx' );
is( $response->code, 200, 'Response Code' );
is_deeply( [ $response->content_type ], [ 'application/json', 'charset=utf-8' ] );
view all matches for this distribution
view release on metacpan or search on metacpan
"Catalyst" : "5.64",
"Catalyst::Test" : "0",
"File::Spec" : "0",
"FindBin" : "0",
"HTTP::Headers" : "0",
"HTTP::Request" : "0",
"JavaScript::Minifier::XS" : "0",
"Moose" : "0",
"MooseX::Aliases" : "0",
"Path::Class::Dir" : "0.17",
"URI" : "0",
view all matches for this distribution
view release on metacpan or search on metacpan
t/01_live.t view on Meta::CPAN
no warnings 'redefine';
*Catalyst::Test::local_request = sub {
my ( $class, $request ) = @_;
require HTTP::Request::AsCGI;
my $cgi = HTTP::Request::AsCGI->new( $request, %ENV )->setup;
$class->handle_request;
return $cgi->restore->response;
};
}
my $entrypoint = "http://localhost/jemplate";
{
my $request = HTTP::Request->new( GET => $entrypoint );
ok( my $response = request($request), 'Request' );
ok( $response->is_success, 'Response Successful 2xx' );
is( $response->code, 200, 'Response Code' );
t/01_live.t view on Meta::CPAN
like $response->content, qr!//line 1 "foo\.tt"!;
like $response->content, qr!//line 1 "bar\.tt"!;
}
{
my $request = HTTP::Request->new( GET => "http://localhost/selected" );
ok( my $response = request($request), 'Request' );
ok( $response->is_success, 'Response Successful 2xx' );
is( $response->code, 200, 'Response Code' );
t/01_live.t view on Meta::CPAN
unlike $response->content, qr!//line 1 "foo\.tt"!;
like $response->content, qr!//line 1 "bar\.tt"!;
}
{
my $request = HTTP::Request->new( GET => "http://localhost/Jemplate.js" );
ok( my $response = request($request), 'Request' );
ok( $response->is_success, 'Response Successful 2xx' );
is( $response->code, 200, 'Response Code' );
view all matches for this distribution
view release on metacpan or search on metacpan
"Encode" : 0,
"English" : 0,
"File::Find" : 0,
"File::Temp" : 0,
"FindBin" : 0,
"HTTP::Request::AsCGI" : 0,
"MRO::Compat" : 0,
"RDF::Simple::Parser" : 0,
"Test::More" : "0.88"
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/WWW/Mechanize/Catalyst.pm view on Meta::CPAN
# are then we'd better cope with it. Let's create a new URI, using
# our request as the base.
my $uri = URI->new_abs( $location, $request->uri )->as_string;
# make a new response, and save the old response in it
$response = $self->_make_request( HTTP::Request->new( GET => $uri ) );
my $end_of_chain = $response;
while ( $end_of_chain->previous ) # keep going till the end
{
$end_of_chain = $end_of_chain->previous;
} # of the chain...
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/View/Template/Lace.pm view on Meta::CPAN
sub view_components {
my ($class, $app, $merged_args) = @_;
return +{
catalyst => {
subrequest => Template::Lace::Utils::mk_component {
require HTTP::Request;
require HTTP::Message::PSGI;
my @args = (delete $_{action});
my $method = ((delete $_{method}) || 'GET');
push @args, delete($_{parts}) if $_{parts};
push @args, delete($_{query}) if $_{query};
my $href = $_{model}->uri_for(@args);
my $http_request = HTTP::Request->new($method, $href);
my $psgi_env = HTTP::Message::PSGI::req_to_psgi($http_request);
my $psgi_response = $_{model}->ctx->psgi_app->($psgi_env);
my $http_response = HTTP::Message::PSGI::res_from_psgi($psgi_response);
my $content = $http_response->content;
if($_{at}) {
view all matches for this distribution
view release on metacpan or search on metacpan
t/04-post.t view on Meta::CPAN
use strict;
use warnings;
use Test::More;
use Catalyst::Test 'TestApp';
use Data::Dumper;
use HTTP::Request::Common; # reqd for POST requests
eval "use PHP 0.13";
if ($@) {
plan skip_all => "PHP 0.13 needed for testing";
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/01-basic.t view on Meta::CPAN
use strict;
use warnings;
use FindBin '$Bin';
use lib "$Bin/lib";
use Catalyst::Test 'TestApp';
use HTTP::Request::Common;
use Test::More tests => 5;
action_ok('/', 'check if the thing runs at all');
view all matches for this distribution
view release on metacpan or search on metacpan
}
sub cookies {
my $res = shift;
my $request = HTTP::Request->new( GET => 'http://localhost/' );
$res->request($request);
my $jar = HTTP::Cookies->new();
$jar->extract_cookies($res);
view all matches for this distribution
view release on metacpan or search on metacpan
use Test::More tests => 10;
use lib 't/MyCMS/lib';
use Catalyst::Test 'MyCMS';
use HTTP::Request::Common;
my $result;
# create a page
ok( $result = request('/cms/mypage?cxcms=create'), "GET create" );
view all matches for this distribution
view release on metacpan or search on metacpan
t/001-file.t view on Meta::CPAN
use_ok('CatalystX::CRUD::Model::File');
use_ok('CatalystX::CRUD::Object::File');
use Catalyst::Test 'MyApp';
use Data::Dump qw( dump );
use HTTP::Request::Common;
use JSON;
####################################################
# basic CRUD
sub json_PUT {
my ( $url, $body, $headers ) = @_;
my $req = HTTP::Request->new( PUT => $url );
$req->headers($headers) if $headers;
$req->header( 'Content-Type' => 'application/json' );
$req->header( 'Content-Length' => length($body) );
$req->content($body);
$req;
t/001-file.t view on Meta::CPAN
{ content => "hello world", file => "testfile" },
"PUT new file response"
);
# read the file we just created
ok( $res = request( HTTP::Request->new( GET => '/rest/file/testfile' ) ),
"GET new file" );
#diag( $res->content );
is_deeply(
view all matches for this distribution
view release on metacpan or search on metacpan
t/01-rdbo.t view on Meta::CPAN
}
use lib qw( t/lib );
use Catalyst::Test 'MyApp';
use Data::Dump qw( dump );
use HTTP::Request::Common;
diag( "testing against Catalyst-Runtime version "
. $Catalyst::Runtime::VERSION );
ok( my $res = request('/foo/test'), "get /foo/test" );
view all matches for this distribution
view release on metacpan or search on metacpan
t/01-dbic.t view on Meta::CPAN
system("cd t/ && $^X insertdb.pl") and die "can't create db: $!";
require Catalyst::Test;
Catalyst::Test->import('MyApp');
use Data::Dump qw( dump );
use HTTP::Request::Common;
ok( my $res = request('/test1'), "get /test1" );
is( $res->content, 13, "right number of results" );
ok( $res = request('/crud/test2?cd.title=Bad'), "get /test2" );
is( $res->content, 3, "iterator for cd.title=Bad" );
t/01-dbic.t view on Meta::CPAN
is( $res->content, 3, "search for cd.title=Bad" );
ok( $res = request('/crud/test4?cd.title=Bad'), "get /test4" );
is( $res->content, 3, "count for cd.title=Bad" );
# read
ok( $res = request( HTTP::Request->new( GET => '/crud/1/view' ) ),
"GET view" );
#diag( $res->content );
is_deeply(
eval $res->content,
view all matches for this distribution
view release on metacpan or search on metacpan
t/01-rdbo.t view on Meta::CPAN
# require to defer till skip checks
require Catalyst::Test;
Catalyst::Test->import('MyRDBO');
use HTTP::Request::Common;
use Data::Dump qw( dump );
use JSON::XS;
#dump MyRDBO::Controller::CRUD::Test::Foo->config;
view all matches for this distribution
view release on metacpan or search on metacpan
t/01-file.t view on Meta::CPAN
use_ok('CatalystX::CRUD::Model::File');
use_ok('CatalystX::CRUD::Object::File');
use Catalyst::Test 'MyApp';
use Data::Dump qw( dump );
use HTTP::Request::Common;
###########################################
# basic sanity check
ok( get('/foo'), "get /foo" );
t/01-file.t view on Meta::CPAN
);
is( $res->code, 302, "new file 302 redirect status" );
# read the file we just created
ok( $res = request( HTTP::Request->new( GET => '/file/testfile/view' ) ),
"GET new file" );
#diag( $res->content );
like( $res->content, qr/content => "hello world"/, "read file" );
t/01-file.t view on Meta::CPAN
ok( $res = request( POST( '/file/testfile2/delete', [] ) ), "rm file2" );
#diag( $res->content );
# confirm it is gone
ok( $res = request( HTTP::Request->new( GET => '/file/testfile/view' ) ),
"confirm we nuked the file" );
#diag( $res->content );
like( $res->content, qr/content => undef/, "file nuked" );
t/01-file.t view on Meta::CPAN
);
# read the file we just created
ok( $res
= request(
HTTP::Request->new( GET => '/fileadapter/testfile/view' ) ),
"GET new file adapter"
);
#diag( $res->content );
t/01-file.t view on Meta::CPAN
#diag( $res->content );
# confirm it is gone
ok( $res
= request(
HTTP::Request->new( GET => '/fileadapter/testfile/view' ) ),
"confirm we nuked the file adapter"
);
#diag( $res->content );
t/01-file.t view on Meta::CPAN
'{ content => "hello world", file => "testfile" }',
"POST new file response adapter"
);
ok( $res = request(
HTTP::Request->new( GET => '/fetchrewrite/id/testfile/view' )
),
"fetch rewrite works"
);
# delete the file
t/01-file.t view on Meta::CPAN
ok( $res = request( POST( '/fetchrewrite/id/testfile/rm', [] ) ),
"rm fetch rewrite" );
# confirm it is gone
ok( $res = request(
HTTP::Request->new( GET => '/fetchrewrite/id/testfile/view' )
),
"confirm we nuked the fetch rewrite file"
);
view all matches for this distribution
view release on metacpan or search on metacpan
"Catalyst::Controller::JMS" : "0",
"Catalyst::Plugin::ConfigLoader" : "0",
"Catalyst::Test" : "0",
"Config::General" : "0",
"Data::Printer" : "0",
"HTTP::Request::Common" : "0",
"Moose" : "2.0801",
"MooseX::MethodAttributes::Role" : "0",
"Net::Stomp::Frame" : "0",
"Test::Fatal" : "0",
"Test::Most" : "0",
view all matches for this distribution
view release on metacpan or search on metacpan
'CatalystX::Controller::ExtJS::REST' => '0',
'DBIx::Class' => '0',
'DBIx::Class::Schema' => '0',
'File::Find' => '0',
'File::Temp' => '0',
'HTTP::Request::Common' => '0',
'JSON' => '0',
'Module::Build' => '0.3601',
'Path::Class::File' => '0',
'Spreadsheet::ParseExcel' => '0',
'Test::More' => '0.88',
view all matches for this distribution
view release on metacpan or search on metacpan
"Catalyst::Controller" => 0,
"Catalyst::Log" => 0,
"Catalyst::ScriptRunner" => 0,
"Catalyst::Test" => 0,
"FindBin" => 0,
"HTTP::Request::Common" => 0,
"Moose" => 0,
"Test::More" => 0,
"Test::Pod" => "1.14",
"Test::Pod::Coverage" => "1.04",
"Test::WWW::Mechanize::Catalyst" => 0,
"Catalyst::Controller" => 0,
"Catalyst::Log" => 0,
"Catalyst::ScriptRunner" => 0,
"Catalyst::Test" => 0,
"FindBin" => 0,
"HTTP::Request::Common" => 0,
"Module::Build" => "0.28",
"Moose" => 0,
"Test::More" => 0,
"Test::Pod" => "1.14",
"Test::Pod::Coverage" => "1.04",
view all matches for this distribution
view release on metacpan or search on metacpan
t/061_signature_matching.t view on Meta::CPAN
use FindBin;
use lib "$FindBin::Bin/lib";
use Test::More;
use Catalyst::Test 'TestApp';
use HTTP::Request::Common;
is get('/sigmatch/test/23'), 'signaturematching/int', 'integer argument dispatched correctly';
is get('/sigmatch/test/foo'), 'signaturematching/str', 'string argument dispatched correctly';
is get('/sigmatch/test/f00'), 'signaturematching/rest', 'no match leads to other dispatched action';
view all matches for this distribution
view release on metacpan or search on metacpan
use Test::More;
use strict;
use warnings;
use HTTP::Request::Common;
use JSON::XS qw(decode_json);
use lib qw(t/lib);
use Test::WWW::Mechanize::Catalyst 'MyApp';
view all matches for this distribution
view release on metacpan or search on metacpan
benchmark/rest.pl view on Meta::CPAN
use strict;
use warnings;
BEGIN { $ENV{CATALYST_DEBUG} = 0; $ENV{DBIC_TRACE} = 0;};
use HTTP::Request::Common;
use JSON;
use lib qw(t/lib);
use Test::WWW::Mechanize::Catalyst 'MyApp';
view all matches for this distribution
view release on metacpan or search on metacpan
Catalyst::Plugin::Session::State::Cookie: 0
Catalyst::Plugin::Session::Store::FastMmap: 0
Catalyst::Test: 0
ExtUtils::MakeMaker: 6.42
FindBin: 0
HTTP::Request: 0
Test::More: 0.62
Test::WWW::Mechanize::Catalyst: 0
configure_requires:
ExtUtils::MakeMaker: 6.42
distribution_type: module
view all matches for this distribution
view release on metacpan or search on metacpan
t/live-test.t view on Meta::CPAN
# setup library path
use FindBin qw($Bin);
use lib "$Bin/lib";
use HTTP::Headers;
use HTTP::Request::Common;
use LWP::Simple qw(!get);
use JSON::Any;
# make sure testapp works
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Authentication/Credential/OAuth2.pm view on Meta::CPAN
package Catalyst::Authentication::Credential::OAuth2;
use Moose;
use MooseX::Types::Common::String qw(NonEmptySimpleStr);
use LWP::UserAgent;
use HTTP::Request::Common;
use JSON::Any;
use Moose::Util;
# ABSTRACT: Authenticate against OAuth2 servers
view all matches for this distribution
view release on metacpan or search on metacpan
abstract: 'Map body and data parameters to a model'
author:
- 'John Napiorkowski <jjnapiork@cpan.org>'
build_requires:
Catalyst::Test: '0'
HTTP::Request::Common: '0'
Test::Lib: '0.003'
Test::Most: '0.34'
configure_requires:
ExtUtils::MakeMaker: '0'
dynamic_config: 0
view all matches for this distribution
view release on metacpan or search on metacpan
t/02_crud.t view on Meta::CPAN
#!/usr/bin/env perl
use FindBin qw/$Bin/;
use lib "$Bin/lib";
use CatalystX::Resource::TestKit;
use Test::Exception;
use HTTP::Request::Common;
use Catalyst::Test qw/TestApp/;
my ($res, $c) = ctx_request('/');
my $schema = $c->model('DB')->schema;
view all matches for this distribution
view release on metacpan or search on metacpan
use Test::More 0.88;
use lib 't/lib';
use Catalyst::Test 'MyApp1';
use HTTP::Request::Common qw( GET PUT POST DELETE );
{
request( GET '/foo', ( Accept => 'application/json' ) );
is(
view all matches for this distribution
view release on metacpan or search on metacpan
Catalyst::Plugin::Session::State::Cookie: 0
CatalystX::InjectComponent: 0
Class::Load: '0.20'
ExtUtils::MakeMaker: 6.36
File::Temp: 0
HTTP::Request::Common: 0
SQL::Translator: 0
Test::Exception: 0
Test::More: '0.94'
configure_requires:
ExtUtils::MakeMaker: 6.36
view all matches for this distribution