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
view release on metacpan or search on metacpan
},
"test" : {
"requires" : {
"Catalyst::Runtime" : "5.80",
"FindBin" : 0,
"HTTP::Request::Common" : 0,
"Moose" : "2.0007",
"Test::More" : "0.98",
"namespace::autoclean" : "0.12",
"syntax" : "0.003"
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CatalystX/Test/MockContext.pm view on Meta::CPAN
version 0.000004
=head1 SYNOPSIS
use HTTP::Request::Common;
use CatalystX::Test::MockContext;
my $m = mock_context('MyApp');
my $c = $m->(GET '/');
lib/CatalystX/Test/MockContext.pm view on Meta::CPAN
=head2 mock_context
my $sub = mock_context('MyApp');
This function returns a closure that takes an L<HTTP::Request> object and returns a
L<Catalyst> context object for that request.
=head1 SOURCE
The development version is on github at L<https://github.com/robrwo/CatalystX-Test-MockContext>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CatalystX/Test/Most.pm view on Meta::CPAN
package CatalystX::Test::Most;
use strictures;
no warnings "uninitialized";
use HTTP::Request::Common ( qw{ GET POST DELETE PUT } );
use Test::More;
use Test::Fatal;
our $AUTHORITY = "cpan:ASHLEY";
our $VERSION = "0.05";
our @EXPORT = ( qw{ GET POST DELETE PUT },
lib/CatalystX/Test/Most.pm view on Meta::CPAN
*{"${calling_package}::$_"} = \&{$_} for @EXPORT;
}
}
# delete is obviously a problem and the rest should maybe be the uc
# anyway and not export the HTTP::Request::Common ones or something new?
#sub get { request( GET( @_ ) ); }
#sub put { request( PUT( @_ ) ); }
#sub post { request( POST( @_ ) ); }
#sub delete { request( DELETE( @_ ) ); }
lib/CatalystX/Test/Most.pm view on Meta::CPAN
=pod
=head1 Name
CatalystX::Test::Most - Test base pulling in L<Catalyst::Test>, L<Test::More>, L<Test::Fatal>, and L<HTTP::Request::Common> for unit tests on Catalyst applications.
=head1 Synopsis
use CatalystX::Test::Most "MyApp";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/CatalystX/Test/Recorder.pm view on Meta::CPAN
use Test::More;
use strict;
use warnings;
use URI;
use HTTP::Request::Common qw(GET HEAD PUT DELETE POST);
use Test::WWW::Mechanize::Catalyst 'MyApp';
my $mech = Test::WWW::Mechanize::Catalyst->new();
$mech->requests_redirectable([]); # disallow redirects
view all matches for this distribution
view release on metacpan or search on metacpan
cpanfile.snapshot view on Meta::CPAN
HTTP::Daemon 6.01
HTTP::Daemon::ClientConn 6.01
requirements:
ExtUtils::MakeMaker 0
HTTP::Date 6
HTTP::Request 6
HTTP::Response 6
HTTP::Status 6
IO::Socket 0
LWP::MediaTypes 6
Sys::Hostname 0
cpanfile.snapshot view on Meta::CPAN
HTTP::Headers 6.05
HTTP::Headers::Auth 6.00
HTTP::Headers::ETag 6.00
HTTP::Headers::Util 6.03
HTTP::Message 6.06
HTTP::Request 6.00
HTTP::Request::Common 6.04
HTTP::Response 6.04
HTTP::Status 6.03
requirements:
Compress::Raw::Zlib 0
Encode 2.21
cpanfile.snapshot view on Meta::CPAN
HTML::HeadParser 0
HTTP::Cookies 6
HTTP::Daemon 6
HTTP::Date 6
HTTP::Negotiate 6
HTTP::Request 6
HTTP::Request::Common 6
HTTP::Response 6
HTTP::Status 6
IO::Select 0
IO::Socket 0
LWP::MediaTypes 6
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catmandu/Importer.pm view on Meta::CPAN
our $VERSION = '1.2025';
use Catmandu::Util qw(io is_value is_string is_array_ref is_hash_ref);
use Catmandu::Util::Path qw(as_path);
use LWP::UserAgent;
use HTTP::Request ();
use URI ();
use URI::Template ();
use Moo::Role;
use namespace::clean;
lib/Catmandu/Importer.pm view on Meta::CPAN
sub _http_request {
my ($self, $method, $url, $headers, $body, $timing_tries) = @_;
my $client = $self->_http_client;
my $req = HTTP::Request->new($method, $url, $headers || []);
$req->content($body) if defined $body;
my $res = $client->request($req);
if ($res->code =~ /^408|500|502|503|504$/ && $timing_tries) {
view all matches for this distribution