The story around automated api tests is as follow:
Solr and MongoDB are spun up using docker-compose, this will happen automatically as part of a lein test because we make use of api-fixture. We may want to make this an explicit step that someone runs in isolation but I've found it useful as it is, for now.
Ping MongoDB/Solr and stall until they are responding successfully.
The API is started with (start-core! :default :api).
Inject any required config changes into the running core. As an example, set the funders rdf location to a local file:
Redef (it's the only real option) any functions that require "mocking" and insert any sample data required for testing. As an example, loading funders:
/works?query={query} - Limited to a subset of possible queries
/works?filter={filter} - Limited to a subset of possible filters
/works?select={select} - Limited to a subset of selectable fields
/works/{doi}/ageny
It's worth noting that none of the source feed xml used for testing have been included as part of this pull request, they are still under consideration as there are issues with redistributing them.
This has turned into a rather large PR but is actually quite isolated, much of the change is around the implementation of automated tests for the API.
Bugs
There are also a number of small bug fixes:
Features
The implementation of the new Peer Review content type:
Other notable commits include:
mass-insert!
to improve funder loading.Tests
The story around automated api tests is as follow:
Solr and MongoDB are spun up using docker-compose, this will happen automatically as part of a
lein test
because we make use ofapi-fixture
. We may want to make this an explicit step that someone runs in isolation but I've found it useful as it is, for now.Ping MongoDB/Solr and stall until they are responding successfully.
The API is started with
(start-core! :default :api)
.Inject any required config changes into the running core. As an example, set the funders rdf location to a local file:
Run applicable tests.
Stop the API with
(stop-core! :default)
.Stop Solr and MongoDB with docker-compose.
Tests are added for the following endpoints:
Funders
Journals
Works
It's worth noting that none of the source feed xml used for testing have been included as part of this pull request, they are still under consideration as there are issues with redistributing them.