Docker-Registry
view release on metacpan or search on metacpan
$io->set_content('{"name":"test2-registry","tags":["version1"]}');
my $result = $d->repository_tags(repository => 'test2-registry');
isa_ok($result, 'Docker::Registry::Result::RepositoryTags');
cmp_ok($result->name, 'eq', 'test2-registry');
cmp_ok($result->tags->[0], 'eq', 'version1');
}
{
$io->set_content('<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="https://console.cloud.google.com/m/gcr/images/redirect?project=infraestructura-global&location=EU&repo_name=v2/_catalog">here</A>.
</BODY></HTML>');
$io->set_status_code(302);
throws_ok(sub {
$d->repositories;
}, 'Docker::Registry::Exception::HTTP');
t/05_pagination.t view on Meta::CPAN
sub _response {
my $args = shift;
my $n = $args->{n} || 2;
return Docker::Registry::Response->new(
status => 200,
headers => {
'docker-distribution-api-version' => 'registry/2.0',
'date' => 'Wed, 21 Oct 2015 07:28:00 GMT',
'transfer-encoding' => 'chunked',
'content-type' => 'text/plain; charset=utf-8',
'connection' => 'keep-alive',
$args->{last}
? (link => "<https://my.awesome.registry/v2/my-repository/tags/list?last=$args->{last}&n=1000>; rel='next'")
: (),
},
content => $args->{content}
? encode_json($args->{content})
: encode_json({ name => 'my-repository', tags => [map { "v$_" } (1..$n)] }),
);
}
( run in 1.599 second using v1.01-cache-2.11-cpan-524268b4103 )