API-DeutscheBahn-Fahrplan
view release on metacpan or search on metacpan
t/01_main.t view on Meta::CPAN
method => 'journey_details',
params => { id => '8596008' },
regex => qr!/journeyDetails/8596008$!,
},
# Failures
{ #
method => 'location',
params => {},
throws => 1,
throws_regex => qr/Missing path parameter: name/,
},
{ #
method => 'departure_board',
params => { id => '8596008' },
throws => 1,
throws_regex => qr/Missing query parameter: date/,
}
);
for (@uri_tests) {
my ( $method, %params ) = ( $_->{method}, %{ $_->{params} } );
if ( $_->{throws} ) {
throws_ok { $fahrplan_free->_create_uri( $method, %params ) }
$_->{throws_regex}, 'error thrown successfully'
and next;
}
my ( undef, $uri ) = $fahrplan_free->_create_uri( $method, %params );
is $uri->scheme, 'https', 'uri scheme set to https';
is $uri->host, 'api.deutschebahn.com', 'uri host set';
like $uri->path_query, $_->{regex},
sprintf 'successfully created uri for %s', $method;
( run in 0.249 second using v1.01-cache-2.11-cpan-496ff517765 )