AtteanX-Endpoint
view release on metacpan or search on metacpan
$mech->get('/gsp?graph=http%3A%2F%2Fexample.org%2Fgraph2', Accept => 'text/turtle');
ok( $mech->success );
is( $mech->ct, 'text/turtle', 'Is text/turtle' );
$mech->content_like(qr#"787"#);
$mech->content_unlike(qr#"123"#);
$mech->content_unlike(qr#"My Document"#);
};
subtest 'PUT named graph' => sub {
$mech->put('/gsp?graph=http%3A%2F%2Fexample.org%2Fgraph2', 'Content-Type' => 'text/turtle', content => '<s> <p> "new content" .');
ok( $mech->success );
$mech->get('/gsp?graph=http%3A%2F%2Fexample.org%2Fgraph2', Accept => 'text/turtle');
is( $mech->ct, 'text/turtle', 'Is text/turtle' );
$mech->content_like(qr/new content/);
$mech->content_unlike(qr#"787"#);
$mech->content_unlike(qr#"123"#);
$mech->content_unlike(qr#"My Document"#);
};
subtest 'PUT default graph' => sub {
$mech->put('/gsp?default', 'Content-Type' => 'text/turtle', content => '<s> <p> "new default content" .');
ok( $mech->success );
$mech->get('/gsp?default', Accept => 'text/turtle');
is( $mech->ct, 'text/turtle', 'Is text/turtle' );
$mech->content_like(qr/new default content/);
$mech->content_unlike(qr#"000"#);
$mech->content_unlike(qr#"123"#);
$mech->content_unlike(qr#"My Document"#);
};
subtest 'DELETE default graph' => sub {
$mech->get('/gsp?default', Accept => 'text/turtle');
ok( $mech->success );
is( $mech->ct, 'text/turtle', 'Is text/turtle' );
$mech->content_like(qr/s>/);
$mech->delete('/gsp?default');
ok( $mech->success );
$mech->get_ok('/gsp?default', {Accept => 'text/turtle'});
$mech->content_unlike(qr/s>/);
};
subtest 'POST named graph' => sub {
$mech->delete('/gsp?graph=http%3A%2F%2Fexample.org%2Fgraph_new');
$mech->post('/gsp?graph=http%3A%2F%2Fexample.org%2Fgraph_new', 'Content-Type' => 'text/turtle', content => '<s> <p> "first POST" .');
ok( $mech->success );
$mech->post('/gsp?graph=http%3A%2F%2Fexample.org%2Fgraph_new', 'Content-Type' => 'text/turtle', content => '<s> <p> "second POST" .');
ok( $mech->success );
$mech->get_ok('/gsp?graph=http%3A%2F%2Fexample.org%2Fgraph_new', {Accept => 'application/n-triples', 'Accept-Encoding' => ''});
is( $mech->ct, 'application/n-triples', 'Is application/n-triples' );
$mech->content_like(qr/first POST/);
$mech->content_like(qr/second POST/);
};
subtest 'PUT named graph (RDF/XML)' => sub {
$mech->delete('/gsp?graph=http%3A%2F%2Fexample.org%2Frdfxml');
$mech->put('/gsp?graph=http%3A%2F%2Fexample.org%2Frdfxml', 'Content-Type' => 'application/rdf+xml', content => <<"END");
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:eg="http://example.org/"
xml:base="http://example.org/dir/file">
<rdf:Description rdf:ID="frag" eg:value="rdf/xml value" />
</rdf:RDF>
END
ok( $mech->success );
$mech->get_ok('/gsp?graph=http%3A%2F%2Fexample.org%2Frdfxml', {Accept => 'application/n-triples', 'Accept-Encoding' => ''});
is( $mech->ct, 'application/n-triples', 'Is application/n-triples' );
$mech->content_like(qr#http://example.org/value#);
$mech->content_like(qr#rdf/xml value#);
};
done_testing();
( run in 1.233 second using v1.01-cache-2.11-cpan-364913b4093 )