NAME
Web::Solid::Test::Basic - Basic Solid Tests
SYNOPSIS
use Test::FITesque::RDF;
my $suite = Test::FITesque::RDF->new(source => $file, base_uri => $ENV{SOLID_REMOTE_BASE})->suite;
$suite->run_tests;
done_testing;
See tests/basic.t for a full example.
DESCRIPTION
See Web::Solid::Test for an introduction to the idea behind these test modules.
IMPLEMENTED TESTS
Test scripts
This package provides tests/basic.t which runs tests over the fixture table in tests/data/basic.ttl. The test script requires the environment variable SOLID_REMOTE_BASE to be set to the base URL that any relative URLs in the fixture tables will be resolved against. Thus, the fixture tables themselves are independent of the host that will run them.
To run the test script in the clone of this package, invoke it like this:
SOLID_REMOTE_BASE="https://kjetiltest4.dev.inrupt.net/" prove -l tests/basic.t
http_read_unauthenticated
Some basic tests for HTTP reads.
Parameters
urlThe URL to request.
Environment
None
Implements
- 1. That an HTTP HEAD request to the given URL succeeds.
 - 2. That an HTTP GET request to the given URL succeeds.
 - 3. That the HEAD and GET requests had the same header fields.
 - 4. That the values of the header fields are the same.
 
http_put_readback_unauthenticated
First writes some content with a PUT request, then reads it back with a GET and checks RDF validity.
Parameters
urlThe URL to request.
Environment
None
Implements
- 1. That an HTTP PUT with content request to the given URL succeeds.
 - 2. That an HTTP GET request to the given URL succeeds.
 - 3. That the content is valid RDF.
 - 4. That the triples in the written and read RDF is the same.
 
http_write_with_bearer
Test for successful HTTP PUT authenticated with a Bearer token
Parameters
urlThe URL to request.
Environment
Set SOLID_BEARER_TOKEN to the bearer token to be used in the authorization header.
Implements
http_methods_with_bearer
Tests for whether a certain HTTP request, authenticated with a Bearer token, returns a certain status code.
Parameters
urlThe URL to request.
methodThe HTTP method to use in the request.
bodyThe body of the request (optional).
codeThe expected status code to tests for.
Environment
Set SOLID_BEARER_TOKEN to the bearer token to be used in the authorization header.
Implements
- 1. That an HTTP request with the given method and body to the given URL with an payload returns the given status code.
 
NOTE
The parameters above are in the RDF formulated as actual full URIs, but where the local part is used here and resolved by the Test::FITesque::RDF framework, see its documentation for details.
TODO
The namespaces used in the current fixture tables are examples, and will be changed before an 1.0 release of the system.
BUGS
Please report any bugs to https://github.com/kjetilk/p5-web-solid-test-basic/issues.
SEE ALSO
AUTHOR
Kjetil Kjernsmo <kjetilk@cpan.org>.
COPYRIGHT AND LICENCE
This software is Copyright (c) 2019 by Inrupt Inc.
This is free software, licensed under:
The MIT (X11) License
DISCLAIMER OF WARRANTIES
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.