view release on metacpan or search on metacpan
"Catalyst::Action::REST" : "0",
"Catalyst::Controller" : "0",
"Catalyst::Test" : "0",
"File::Spec" : "0",
"FindBin" : "0",
"HTTP::Request" : "0",
"IO::Handle" : "0",
"IPC::Open3" : "0",
"Test::More" : "0",
"Test::Warnings" : "0",
"Time::HiRes" : "0",
view all matches for this distribution
view release on metacpan or search on metacpan
build_requires:
Catalyst::Test: 0
Data::Dumper: 0
ExtUtils::MakeMaker: 6.42
FindBin: 0
HTTP::Request::Common: 5.824
Path::Class: 0.16
Test::Deep: 0.103
Test::Differences: 0.4801
Test::More: 0.92
Test::Most: 0.21
view all matches for this distribution
view release on metacpan or search on metacpan
"Catalyst" : "5.90129",
"Catalyst::Controller" : "0",
"Catalyst::Test" : "0",
"File::Spec" : "0",
"FindBin" : "0",
"HTTP::Request::Common" : "0",
"HTTP::Status" : "0",
"Module::Metadata" : "1.000015",
"Moose" : "0",
"Path::Tiny" : "0",
"Plack::Builder" : "0",
view all matches for this distribution
view release on metacpan or search on metacpan
t/02static.t view on Meta::CPAN
use Catalyst::Test 'TestApp';
use File::stat;
use File::Slurp;
use HTTP::Date;
use HTTP::Request::Common;
my $stat = stat($0);
{
ok( my $response = request('/02static.t'), 'Request' );
view all matches for this distribution
view release on metacpan or search on metacpan
abstract: 'Sugar and strong errors for $c->uri_for'
author:
- 'John Napiorkowski <jjnapiork@cpan.org>'
build_requires:
Catalyst: '5.90060'
HTTP::Request::Common: '0'
Test::Most: '0'
configure_requires:
ExtUtils::MakeMaker: '0'
dynamic_config: 0
generated_by: 'Dist::Zilla version 6.025, CPAN::Meta::Converter version 2.150010'
view all matches for this distribution
view release on metacpan or search on metacpan
- 'John Napiorkowski <jjnapiork@cpan.org>'
build_requires:
Catalyst: 5.90001
Catalyst::Test: 0
FindBin: 0
HTTP::Request::Common: 0
Moose: 0
Plack::App::File: 0
Plack::App::URLMap: 0
Plack::Component: 0
Plack::Util: 0
view all matches for this distribution
view release on metacpan or search on metacpan
t/04uploadprogress.t view on Meta::CPAN
unlink "$FindBin::Bin/cache.dat" if -e "$FindBin::Bin/cache.dat";
}
use Test::More;
use Catalyst::Test 'TestApp';
use HTTP::Request::Common;
eval {
require Catalyst::Plugin::Cache::FastMmap;
};
if ($@) {
view all matches for this distribution
view release on metacpan or search on metacpan
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;
};
# test echo
{
my $content =
RPC::XML::request->new( 'myAPI.echo', 'hello' )->as_string;
my $request = HTTP::Request->new( POST => $entrypoint );
$request->header( 'Content-Length' => length($content) );
$request->header( 'Content-Type' => 'text/xml' );
$request->content($content);
ok( my $response = request($request), 'Request' );
# test add
{
my $content =
RPC::XML::request->new( 'plugin.xmlrpc.add', ( 1, 2 ) )->as_string;
my $request = HTTP::Request->new( POST => $entrypoint );
$request->header( 'Content-Length' => length($content) );
$request->header( 'Content-Type' => 'text/xml' );
$request->content($content);
ok( my $response = request($request), 'Request' );
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Catalyst/Test.pm view on Meta::CPAN
use Catalyst::Test 'TestApp';
my $content = get('index.html'); # Content as string
my $response = request('index.html'); # HTTP::Response object
my($res, $c) = ctx_request('index.html'); # HTTP::Response & context object
use HTTP::Request::Common;
my $response = request POST '/foo', [
bar => 'baz',
something => 'else'
];
lib/Catalyst/Test.pm view on Meta::CPAN
=head1 DESCRIPTION
This module allows you to make requests to a Catalyst application either without
a server, by simulating the environment of an HTTP request using
L<HTTP::Request::AsCGI> or remotely if you define the CATALYST_SERVER
environment variable. This module also adds a few Catalyst-specific
testing methods as displayed in the method section.
The L<get|/"$content = get( ... )"> and L<request|/"$res = request( ... );">
functions take either a URI or an L<HTTP::Request> object.
=head1 INLINE TESTS WILL NO LONGER WORK
While it used to be possible to inline a whole test app into a C<.t> file for
a distribution, this will no longer work.
lib/Catalyst/Test.pm view on Meta::CPAN
header configuration; currently only supports setting 'host' value.
my $res = request('foo/bar?test=1');
my $virtual_res = request('foo/bar?test=1', {host => 'virtualhost.com'});
Alternately, you can pass in an L<HTTP::Request::Common> object to set arbitrary
request headers.
my $res = request(GET '/foo/bar',
X-Foo => 'Bar',
Authorization => 'Bearer JWT_HERE',
lib/Catalyst/Test.pm view on Meta::CPAN
Verify the given URL has a content type of $type and optionally specify a test name.
=head1 SEE ALSO
L<Catalyst>, L<Test::WWW::Mechanize::Catalyst>,
L<Test::WWW::Selenium::Catalyst>, L<Test::More>, L<HTTP::Request::Common>
=head1 AUTHORS
Catalyst Contributors, see Catalyst.pm
view all matches for this distribution
view release on metacpan or search on metacpan
t/another_site_blog.t view on Meta::CPAN
use Test::More tests => 5;
use HTTP::Request;
use HTTP::Request::Common;
use Test::HTML::Form;
use lib qw(t/lib);
use Catalyst::Test qw(TestBlogApp);
my $main_url = '/blog';
my $hr = HTTP::Request->new('GET', $main_url);
$hr->header(Host => 'foo.bar');
my $r=request($hr);
unless(ok($r->is_success, 'got main blog page ok')) {
if($r->code == 500) {
view all matches for this distribution
view release on metacpan or search on metacpan
"requires" : {
"Catalyst" : 0,
"Catalyst::Controller" : 0,
"Catalyst::Test" : 0,
"FindBin" : 0,
"HTTP::Request::Common" : 0,
"Moose" : 0,
"Test::More" : 0
}
}
},
view all matches for this distribution
view release on metacpan or search on metacpan
t/live-test.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;
};
t/live-test.t view on Meta::CPAN
# test first available view
{
my $expected = 'View';
my $request =
HTTP::Request->new( GET => 'http://localhost:3000/test_firstview' );
ok( my $response = request($request), 'Request' );
ok( $response->is_success, 'Response Successful 2xx' );
is( $response->header( 'Content-Type' ), 'text/html; charset=utf-8', 'Content Type' );
is( $response->code, 200, 'Response Code' );
t/live-test.t view on Meta::CPAN
# test view
{
my $expected = 'View';
my $request =
HTTP::Request->new( GET => 'http://localhost:3000/test_view' );
ok( my $response = request($request), 'Request' );
ok( $response->is_success, 'Response Successful 2xx' );
is( $response->header( 'Content-Type' ), 'text/html; charset=utf-8', 'Content Type' );
is( $response->code, 200, 'Response Code' );
t/live-test.t view on Meta::CPAN
# test skip view
{
my $expected = 'Skipped View';
my $request =
HTTP::Request->new( GET => 'http://localhost:3000/test_skipview' );
ok( my $response = request($request), 'Request' );
ok( $response->is_success, 'Response Successful 2xx' );
is( $response->header( 'Content-Type' ), 'text/html; charset=utf-8', 'Content Type' );
is( $response->code, 200, 'Response Code' );
view all matches for this distribution
view release on metacpan or search on metacpan
Catalyst::Test: 0
DBI: 0
DBIx::Class::Core: 0
DBIx::Class::Schema: 0
FindBin: 0
HTTP::Request::Common: 0
Moose: 0
Test::More: 0
base: 0
strict: 0
warnings: 0
view all matches for this distribution
view release on metacpan or search on metacpan
abstract: 'methods for your request object to assist in content negotiation'
author:
- 'John Napiorkowski <jjnapiork@cpan.org>'
build_requires:
Catalyst::Test: '0'
HTTP::Request::Common: '0'
Test::Most: '0.34'
configure_requires:
ExtUtils::MakeMaker: '0'
dynamic_config: 0
generated_by: 'Dist::Zilla version 5.041, CPAN::Meta::Converter version 2.150005'
view all matches for this distribution
view release on metacpan or search on metacpan
t/01-json_decoder.t view on Meta::CPAN
use strict;
use warnings;
use lib 't/lib';
use Test::More;
use JSON::Any;
use HTTP::Request::Common;
BEGIN {
use_ok 'Catalyst::Test', 'Simple';
}
view all matches for this distribution
view release on metacpan or search on metacpan
"dynamic_config" : 0,
"generated_by" : "Dist::Zilla version 6.030, CPAN::Meta::Converter version 2.150010",
"keywords" : [
"Catalyst",
"Catalyst::Request",
"HTTP::Request"
],
"license" : [
"artistic_2"
],
"meta-spec" : {
},
"requires" : {
"Catalyst" : "5.90090",
"Catalyst::Test" : "0",
"File::Spec" : "0",
"HTTP::Request" : "0",
"HTTP::Request::Common" : "0",
"Module::Metadata" : "0",
"Moose" : "0",
"Plack::Middleware::MethodOverride" : "0",
"Test::More" : "0",
"Test::Most" : "0",
view all matches for this distribution
view release on metacpan or search on metacpan
Catalyst::Plugin::Session::State::Cookie: 0
Catalyst::Plugin::Session::Store::File: 0
Catalyst::View::TT: 0
CatalystX::RoleApplicator: 0
ExtUtils::MakeMaker: 6.42
HTTP::Request::Common: 0
Test::More: 0
configure_requires:
ExtUtils::MakeMaker: 6.42
distribution_type: module
generated_by: 'Module::Install version 0.99'
view all matches for this distribution
view release on metacpan or search on metacpan
- 'Tomas Doran (t0m) C<< <bobtfish@bobtfish.net> >>'
build_requires:
Catalyst::Runtime: 5.80007
CatalystX::RoleApplicator: 0.005
ExtUtils::MakeMaker: 6.42
HTTP::Request::Common: 0
Test::More: 0.88
configure_requires:
ExtUtils::MakeMaker: 6.42
distribution_type: module
generated_by: 'Module::Install version 0.910'
view all matches for this distribution
view release on metacpan or search on metacpan
author:
- 'John Napiorkowski <jjnapiork@cpan.org>'
build_requires:
Catalyst::Test: '0'
Data::Dumper: '0'
HTTP::Request::Common: '0'
Test::Most: '0.34'
configure_requires:
ExtUtils::MakeMaker: '0'
dynamic_config: 0
generated_by: 'Dist::Zilla version 5.039, CPAN::Meta::Converter version 2.150005'
view all matches for this distribution
view release on metacpan or search on metacpan
abstract: 'methods for your request object to assist in content negotiation'
author:
- 'John Napiorkowski <jjnapiork@cpan.org>'
build_requires:
Catalyst::Test: '0'
HTTP::Request::Common: '0'
Test::Most: '0.34'
configure_requires:
ExtUtils::MakeMaker: '0'
dynamic_config: 0
generated_by: 'Dist::Zilla version 6.024, CPAN::Meta::Converter version 2.150010'
view all matches for this distribution
view release on metacpan or search on metacpan
abstract: 'Enforce structural rules on your body and data parameters'
author:
- 'John Napiorkowski <jjnapiork@cpan.org>'
build_requires:
Catalyst::Test: '0'
HTTP::Request::Common: '0'
Test::Most: '0.34'
configure_requires:
ExtUtils::MakeMaker: '0'
dynamic_config: 0
generated_by: 'Dist::Zilla version 6.024, CPAN::Meta::Converter version 2.150010'
view all matches for this distribution
view release on metacpan or search on metacpan
use strict;
use warnings;
use Test::More;
use HTTP::Request::Common;
use FindBin;
use lib "$FindBin::Bin/lib";
use Catalyst::Test 'TestApp';
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",
"Moose" : "0",
"MooseX::Aliases" : "0",
"Path::Class::Dir" : "0.17",
"Test::More" : "0.88",
"URI" : "0",
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
}
},
"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