Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(incomplete) test file for the release controller
- Loading branch information
Showing
1 changed file
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
use strict; | ||
use warnings; | ||
|
||
use Encode; | ||
use MetaCPAN::Server::Test; | ||
use MetaCPAN::TestHelpers; | ||
use Test::More; | ||
|
||
{ | ||
no warnings 'redefine'; | ||
|
||
sub get_ok { | ||
my ( $cb, $url, $desc, $headers ) = @_; | ||
ok( my $res = $cb->( GET $url ), $desc || "GET $url" ); | ||
is( $res->code, 200, 'code 200' ); | ||
|
||
test_cache_headers( $res, $headers ); | ||
|
||
return $res; | ||
} | ||
} | ||
|
||
sub get_json_ok { | ||
return decode_json_ok( get_ok(@_) ); | ||
} | ||
|
||
test_psgi app, sub { | ||
my $cb = shift; | ||
|
||
# find (/release/DIST) | ||
get_json_ok( | ||
$cb, | ||
'/release/Moose', | ||
'GET /release/dist', | ||
{ | ||
# ??? | ||
cache_control => 'private', | ||
surrogate_key => | ||
'content_type=application/json content_type=application', | ||
surrogate_control => undef, | ||
} | ||
); | ||
|
||
# get (/release/AUTHOR/NAME) | ||
get_json_ok( | ||
$cb, | ||
'/release/DOY/Moose-0.01', | ||
'GET /release/DOY/Moose-0.01', | ||
{ | ||
# ??? | ||
} | ||
); | ||
|
||
# versions (/release/versions/DIST) | ||
get_json_ok( | ||
$cb, | ||
'/release/versions/Moose', | ||
'GET /release/versions/Moose', | ||
{ | ||
# ??? | ||
} | ||
); | ||
|
||
# latest_by_distribution (/release/latest_by_distribution/DIST) | ||
get_json_ok( | ||
$cb, | ||
'/release/latest_by_distribution/Moose', | ||
'GET /release/latest_by_distribution/Moose', | ||
{ | ||
# ??? | ||
} | ||
); | ||
}; | ||
|
||
done_testing; | ||
|