view release on metacpan or search on metacpan
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to humanity, the best way to achieve this is to make it
free software which everyone can redistribute and change under these
terms.
To do so, attach the following notices to the program. It is safest to
attach them to the start of each source file to most effectively convey
the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
README
README.md
lib/API/ParallelsWPB.pm
lib/API/ParallelsWPB/Requests.pm
lib/API/ParallelsWPB/Response.pm
t/00-compile.t
t/01_load_modules.t
t/02_response.t
t/03_f_request.t
t/04_requests.t
t/author-test-eol.t
t/lib/API/ParallelsWPB/Mock.pm
t/lib/Mock.pm
t/release-distmeta.t
t/release-kwalitee.t
t/release-no-tabs.t
t/release-pod-coverage.t
t/release-pod-syntax.t
t/release-test-version.t
"requires" : {
"Carp" : "0",
"JSON::XS" : "0",
"LWP::Protocol::https" : "0",
"LWP::UserAgent" : "0",
"perl" : "5.008009",
"strict" : "0",
"warnings" : "0"
}
},
"test" : {
"requires" : {
"File::Spec" : "0",
"File::Temp" : "0",
"HTTP::Response" : "6.04",
"IO::Handle" : "0",
"IPC::Open3" : "0",
"Test::Fatal" : "0.010",
"Test::More" : "0.98",
"Test::Pod" : "1.22",
"Test::Warnings" : "0.010"
Makefile.PL view on Meta::CPAN
"File::Temp" => 0,
"HTTP::Response" => "6.04",
"IO::Handle" => 0,
"IPC::Open3" => 0,
"Test::Fatal" => "0.010",
"Test::More" => "0.98",
"Test::Pod" => "1.22",
"Test::Warnings" => "0.010"
},
"VERSION" => "0.03",
"test" => {
"TESTS" => "t/*.t"
}
);
my %FallbackPrereqs = (
"Carp" => 0,
"File::Spec" => 0,
"File::Temp" => 0,
"HTTP::Response" => "6.04",
t/00-compile.t view on Meta::CPAN
use strict;
use warnings;
# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.037
use Test::More tests => 3 + ($ENV{AUTHOR_TESTING} ? 1 : 0);
my @module_files = (
'API/ParallelsWPB.pm',
'API/ParallelsWPB/Requests.pm',
'API/ParallelsWPB/Response.pm'
);
# fake home for cpan-testers
use File::Temp;
local $ENV{HOME} = File::Temp::tempdir( CLEANUP => 1 );
my $inc_switch = -d 'blib' ? '-Mblib' : '-Ilib';
use File::Spec;
use IPC::Open3;
use IO::Handle;
t/01_load_modules.t view on Meta::CPAN
#!/usr/bin/perl
use strict;
use warnings;
use Test::More tests => 51;
use FindBin qw/ $Bin /;
use lib "$Bin/../lib";
use_ok('API::ParallelsWPB');
use_ok('API::ParallelsWPB::Requests');
use_ok('API::ParallelsWPB::Response');
my @basic_methods = qw/
new
f_request
t/01_load_modules.t view on Meta::CPAN
json
success
response
status
/;
for my $response_method ( @response_methods ) {
can_ok('API::ParallelsWPB::Response', $response_method);
}
done_testing();
t/02_response.t view on Meta::CPAN
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More tests => 2;
use Data::Dumper;
use API::ParallelsWPB::Response;
use HTTP::Response;
use API::ParallelsWPB;
subtest 'Response ok' => sub {
plan tests => 3;
my $r = HTTP::Response->new;
$r->code( 200 );
$r->content( '{"response":"b6a09c08f880f229c091de03b91bdbc3"}' );
my $response = API::ParallelsWPB::Response->new( $r );
ok( $response->success, 'Response status succeeded' );
is(
$response->response,
'b6a09c08f880f229c091de03b91bdbc3',
'Response content is ok'
);
is( $response->status, '200 OK', 'Status line is ok' );
};
subtest 'Response errored' => sub {
plan tests => 4;
my $r = HTTP::Response->new;
$r->code( 404 );
$r->content(
'{"error":{"message":"Requested resource does not exist by URI: /api/5.3/sites/"}}'
);
my $response = API::ParallelsWPB::Response->new( $r );
ok( !$response->success, 'Response is not succeeded' );
like(
t/03_f_request.t view on Meta::CPAN
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More tests => 5;
use Data::Dumper;
use API::ParallelsWPB;
use API::ParallelsWPB::Response;
use utf8;
my %transfered_params = ();
{
no warnings 'redefine';
t/03_f_request.t view on Meta::CPAN
%transfered_params = (
self => $self,
data => $data,
url => $url,
post_data => $post_data
);
};
}
my $client = API::ParallelsWPB->new(
username => 'test',
password => 'passw0rd',
server => '127.0.0.1'
);
subtest 'Test GET request' => sub {
plan tests => 2;
$client->f_request( [qw/ system version /], { req_type => 'get' } );
is( $transfered_params{url}, 'https://127.0.0.1/api/5.3/system/version/',
'URL is ok' );
is_deeply(
$transfered_params{data},
{ req_type => 'GET' },
'Request type is GET'
);
};
subtest 'Test POST request' => sub {
plan tests => 3;
$client->f_request(
['sites'],
{
req_type => 'post',
post_data => [ { state => 'trial' } ]
}
);
is(
t/03_f_request.t view on Meta::CPAN
is( $transfered_params{post_data},
qq/[{"state":"trial"}]/, 'POST data is ok' );
is_deeply(
$transfered_params{data},
{ req_type => 'POST', post_data => [ { state => 'trial' } ] },
'Request type is POST'
);
};
subtest 'Test POST request with uuid' => sub {
plan tests => 4;
$client->f_request(
[ 'sites', '123', 'token' ],
{
req_type => 'post',
post_data => [
{
localeCode => 'de_DE',
sessionLifeTime => 1000
}
t/03_f_request.t view on Meta::CPAN
localeCode => 'de_DE',
sessionLifeTime => 1000
}
]
},
'Request type with uuid is POST'
);
};
subtest 'Test unicode chars' => sub {
plan tests => 1;
$client->f_request(
[ 'sites', '123' ],
{
req_type => 'put',
post_data => [
{
ownerInfo => {
personalName => 'ÐаÑилиÑÑ ÐÑпкинÑÑ'
}
t/03_f_request.t view on Meta::CPAN
);
like(
$transfered_params{post_data},
qr/ÐаÑилиÑÑ ÐÑпкинÑÑ/,
'Unicode char is ok in request'
);
};
subtest 'Test utf-8' => sub {
no utf8;
plan tests => 1;
$client->f_request(
[ 'sites', '123' ],
{
req_type => 'put',
post_data => [
{
ownerInfo => {
personalName => 'ÐаÑилиÑÑ ÐÑпкинÑÑ'
}
t/04_requests.t view on Meta::CPAN
use warnings;
use Test::More;
use Data::Dumper;
use API::ParallelsWPB;
use API::ParallelsWPB::Response;
use t::lib::Mock;
my $client = t::lib::Mock->new(
username => 'test',
password => 'passw0rd',
server => '127.0.0.1'
);
subtest 'get_version' => sub {
plan tests => 2;
$client->get_version;
my $p = $client->get_request_params;
like( $p->{url}, qr{/api/5.3/system/version/},
'URL for get version is ok' );
is( $p->{data}->{req_type}, 'GET', 'Reqtype for get_version is ok' );
};
subtest 'create_site' => sub {
plan tests => 3;
# after site creation uuid goes to $client, and methods with uuid required can be called without uuid in params
my $client = t::lib::Mock->new(
username => 'test',
password => 'passw0rd',
server => '127.0.0.1'
);
$client->create_site( state => 'regular' );
my $p = $client->get_request_params;
like( $p->{url}, qr{/api/5.3/sites/}, 'URL for create_site is ok' );
like( $p->{post_data}, qr{"state":"regular"},
'post_data for create_site is ok' );
is( $p->{data}->{req_type}, 'POST', 'Reqtype for create_site is ok' );
};
subtest 'gen_token' => sub {
$client->gen_token( uuid => '6d3f6f9f-55b2-899f-5fb4-ae04b325e360' );
my $p = $client->get_request_params;
like(
$p->{url},
qr{/api/5.3/sites/[\d\w\-]+/token/},
'URL for gen_token is ok'
);
like( $p->{post_data}, qr{"sessionLifeTime":"1800"},
'post_data for gen_token is ok' );
is( $p->{data}->{req_type}, 'POST', 'Reqtype for gen_token is ok' );
};
# URI: /api/5.3/sites/{site_uuid}/deploy
subtest 'deploy' => sub {
$client->deploy(
uuid => '6d3f6f9f-55b2-899f-5fb4-ae04b325e360',
title => 'Tiitle'
);
my $p = $client->get_request_params;
like(
$p->{url},
qr{/api/5.3/sites/[\d\w\-]+/deploy},
'URL for deploy is ok'
);
like( $p->{post_data}, qr{"generic","en_US","Tiitle"}, 'post_data for deploy is ok' );
is( $p->{data}->{req_type}, 'POST', 'Reqtype for deploy is ok' );
};
# /api/5.3/sites/{site_uuid}/
subtest 'get_site_info' => sub {
$client->get_site_info(
uuid => '6d3f6f9f-55b2-899f-5fb4-ae04b325e360',
);
my $p = $client->get_request_params;
like(
$p->{url},
qr{/api/5.3/sites/[\d\w\-]+/},
'URL for get_site_info is ok'
);
is( $p->{data}->{req_type}, 'GET', 'Reqtype for get_site_info is ok' );
};
# /api /5.3/sites/
subtest 'get_sites_info' => sub {
$client->get_sites_info;
my $p = $client->get_request_params;
like(
$p->{url},
qr{/api/5.3/sites/},
'URL for get_sites_info is ok'
);
is( $p->{data}->{req_type}, 'GET', 'Reqtype for get_sites_info is ok' );
};
# /api/5.3/sites/{site_uuid}/
subtest 'change_site_properties' => sub {
$client->change_site_properties(
uuid => '6d3f6f9f-55b2-899f-5fb4-ae04b325e360',
state => 'trial'
);
my $p = $client->get_request_params;
like(
$p->{url},
qr{/api/5.3/sites/[\d\w\-]+/},
'URL for change_site_properties is ok'
);
like( $p->{post_data}, qr{"state":"trial"}, 'post_data for change_site_properties is ok' );
is( $p->{data}->{req_type}, 'PUT', 'Reqtype for change_site_properties is ok' );
};
# /api/5.3/sites/{siteUuid}/publish
subtest 'publish' => sub {
$client->publish(
uuid => '6d3f6f9f-55b2-899f-5fb4-ae04b325e360',
);
my $p = $client->get_request_params;
like(
$p->{url},
qr{/api/5.3/sites/[\d\w\-]+/publish/},
'URL for publish is ok'
);
is( $p->{data}->{req_type}, 'POST', 'Reqtype for publish is ok' );
};
# /api/5.3/sites/{siteUuid}/
subtest 'delete_site' => sub {
$client->delete_site(
uuid => '6d3f6f9f-55b2-899f-5fb4-ae04b325e360',
);
my $p = $client->get_request_params;
like(
$p->{url},
qr{/api/5.3/sites/[\d\w\-]+/},
'URL for delete_site is ok'
);
is( $p->{data}->{req_type}, 'DELETE', 'Reqtype for delete_site is ok' );
};
# /api/5.3/system/promo-footer
subtest 'get_promo_footer' => sub {
$client->get_promo_footer;
my $p = $client->get_request_params;
like(
$p->{url},
qr{/api/5.3/system/promo-footer},
'URL for get_promo_footer is ok'
);
is( $p->{data}->{req_type}, 'GET', 'Reqtype for get_promo_footer is ok' );
};
# /api/5.3/sites/{site_uuid}/custom-properties
subtest 'get_site_custom_variable' => sub {
$client->get_site_custom_variable(
uuid => '6d3f6f9f-55b2-899f-5fb4-ae04b325e360',
);
my $p = $client->get_request_params;
like(
$p->{url},
qr{/api/5.3/sites/[\d\w\-]+/custom-properties},
'URL for get_site_custom_variable is ok'
);
is( $p->{data}->{req_type}, 'GET', 'Reqtype for get_site_custom_variable is ok' );
};
# /api/5.3/sites/{site_uuid}/custom-properties
subtest 'set_site_custom_variable' => sub {
$client->set_site_custom_variable(
uuid => '6d3f6f9f-55b2-899f-5fb4-ae04b325e360',
);
my $p = $client->get_request_params;
like(
$p->{url},
qr{/api/5.3/sites/[\d\w\-]+/custom-properties},
'URL for set_site_custom_variable is ok'
);
is( $p->{data}->{req_type}, 'PUT', 'Reqtype for set_site_custom_variable is ok' );
};
# /api/5.3/sites/{site_uuid}/custom-properties
subtest 'get_sites_custom_variables' => sub {
$client->get_sites_custom_variables;
my $p = $client->get_request_params;
like(
$p->{url},
qr{/api/5.3/system/custom-properties},
'URL for get_sites_custom_variables is ok'
);
is( $p->{data}->{req_type}, 'GET', 'Reqtype for get_sites_custom_variables is ok' );
};
# /api/5.3/sites/{site_uuid}/custom-properties
subtest 'get_sites_custom_variables' => sub {
$client->get_sites_custom_variables;
my $p = $client->get_request_params;
like(
$p->{url},
qr{/api/5.3/system/custom-properties},
'URL for get_sites_custom_variables is ok'
);
is( $p->{data}->{req_type}, 'GET', 'Reqtype for get_sites_custom_variables is ok' );
};
# /api/5.3/sites/{site_uuid}/custom-properties
subtest 'set_sites_custom_variables' => sub {
$client->set_sites_custom_variables;
my $p = $client->get_request_params;
like(
$p->{url},
qr{/api/5.3/system/custom-properties},
'URL for set_sites_custom_variables is ok'
);
is( $p->{data}->{req_type}, 'PUT', 'Reqtype for set_sites_custom_variables is ok' );
};
# /api/5.3/sites/{site_uuid}/custom-properties
subtest 'set_custom_trial_messages' => sub {
$client->set_custom_trial_messages;
my $p = $client->get_request_params;
like(
$p->{url},
qr{/api/5.3/system/trial-mode/messages},
'URL for set_custom_trial_messages is ok'
);
is( $p->{data}->{req_type}, 'PUT', 'Reqtype for set_custom_trial_messages is ok' );
};
# /api/5.3/sites/{site_uuid}/custom-properties
subtest 'get_custom_trial_messages' => sub {
$client->get_custom_trial_messages;
my $p = $client->get_request_params;
like(
$p->{url},
qr{/api/5.3/system/trial-mode/messages},
'URL for get_custom_trial_messages is ok'
);
is( $p->{data}->{req_type}, 'GET', 'Reqtype for get_custom_trial_messages is ok' );
};
# /api/5.3/sites/{site_uuid}/custom-properties
subtest 'change_promo_footer' => sub {
$client->change_promo_footer( message => 'test' );
my $p = $client->get_request_params;
like(
$p->{url},
qr{/api/5.3/system/promo-footer},
'URL for change_promo_footer is ok'
);
is( $p->{post_data}, q/["test"]/, 'Post data for change_promo_footer is ok');
is( $p->{data}->{req_type}, 'PUT', 'Reqtype for change_promo_footer is ok' );
};
done_testing;
t/author-test-eol.t view on Meta::CPAN
BEGIN {
unless ($ENV{AUTHOR_TESTING}) {
require Test::More;
Test::More::plan(skip_all => 'these tests are for testing by the author');
}
}
use strict;
use warnings;
use Test::More;
# generated by Dist::Zilla::Plugin::Test::EOL 0.08
use Test::EOL;
t/lib/API/ParallelsWPB/Mock.pm view on Meta::CPAN
package API::ParallelsWPB::Mock;
use strict;
use warnings;
use base 'API::ParallelsWPB';
# ABSTRACT: mock for testing API::ParallelsWPB
# VERSION
# AUTHORITY
1;
t/lib/Mock.pm view on Meta::CPAN
package t::lib::Mock;
use strict;
use warnings;
use base 'API::ParallelsWPB';
# ABSTRACT: mock for testing API::ParallelsWPB
# VERSION
# AUTHORITY
my %send_request_params = ();
{
no warnings 'redefine';
*API::ParallelsWPB::_send_request = sub {
my ( $self, $data, $url, $post_data ) = @_;
t/release-distmeta.t view on Meta::CPAN
#!perl
BEGIN {
unless ($ENV{RELEASE_TESTING}) {
require Test::More;
Test::More::plan(skip_all => 'these tests are for release candidate testing');
}
}
# This file was automatically generated by Dist::Zilla::Plugin::MetaTests.
use Test::CPAN::Meta;
meta_yaml_ok();
t/release-kwalitee.t view on Meta::CPAN
BEGIN {
unless ($ENV{RELEASE_TESTING}) {
require Test::More;
Test::More::plan(skip_all => 'these tests are for release candidate testing');
}
}
# this test was generated with Dist::Zilla::Plugin::Test::Kwalitee 2.07
use strict;
use warnings;
use Test::Kwalitee;
t/release-no-tabs.t view on Meta::CPAN
BEGIN {
unless ($ENV{RELEASE_TESTING}) {
require Test::More;
Test::More::plan(skip_all => 'these tests are for release candidate testing');
}
}
use strict;
use warnings;
# this test was generated with Dist::Zilla::Plugin::Test::NoTabs 0.05
use Test::More 0.88;
use Test::NoTabs;
my @files = (
'lib/API/ParallelsWPB.pm',
'lib/API/ParallelsWPB/Requests.pm',
'lib/API/ParallelsWPB/Response.pm'
);
notabs_ok($_) foreach @files;
done_testing;
t/release-pod-coverage.t view on Meta::CPAN
#!perl
BEGIN {
unless ($ENV{RELEASE_TESTING}) {
require Test::More;
Test::More::plan(skip_all => 'these tests are for release candidate testing');
}
}
# This file was automatically generated by Dist::Zilla::Plugin::PodCoverageTests.
use Test::Pod::Coverage 1.08;
use Pod::Coverage::TrustPod;
all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' });
t/release-pod-syntax.t view on Meta::CPAN
#!perl
BEGIN {
unless ($ENV{RELEASE_TESTING}) {
require Test::More;
Test::More::plan(skip_all => 'these tests are for release candidate testing');
}
}
# This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests.
use Test::More;
use Test::Pod 1.41;
all_pod_files_ok();
t/release-test-version.t view on Meta::CPAN
BEGIN {
unless ($ENV{RELEASE_TESTING}) {
require Test::More;
Test::More::plan(skip_all => 'these tests are for release candidate testing');
}
}
use strict;
use warnings;
use Test::More;
# generated by Dist::Zilla::Plugin::Test::Version 0.002004
BEGIN { eval "use Test::Version; 1;" or die $@; }
t/release-test-version.t view on Meta::CPAN
has_version => 1,
};
push @imports, $params
if version->parse( $Test::Version::VERSION ) >= version->parse('1.002');
Test::Version->import(@imports);
version_all_ok;
done_testing;