gigascience / gigadb-website

Source code for running GigaDB
http://gigadb.org
GNU General Public License v3.0
9 stars 15 forks source link

Create a fake DataCite MDS API #1752

Open rija opened 7 months ago

rija commented 7 months ago

User story

As a developer
I want to access an MDS test API on which I can create and delete any number of DOIs So that I can get more confidence that the mint doi workflow is working with all its use cases And that we can make with confidence any changes to the mint doi workflow as necessary

Acceptance criteria

Given I am implementing a client to DataCite
When I run automated tests against endpoint on Datacite
Then the real DataCite API is not accessed

Given I am implementing a client to DataCite
When I run automated tests against endpoint on Datacite
Then a local alternative that mimics the response to real requests is accessed

Additional Info

We only create the method/endpoint for DOI creation Any other query made to our fake API will be passed through directly to the real test MDS API that way we use the sea fake API for all our mint doi tests and don't have the burden of maintaining a full API that stays in sync with changes to the real test MDS API

We could use json-server which is already in our dependency. Alternatively, we could use a recording device like php-vcr to record requests and responses into tapes that are replayed by automated tests.

Product Backlog Item Ready Checklist

Product Backlog Item Done Checklist

rija commented 7 months ago

We may close this as apparently Datacite reset regularly the test registry

rija commented 1 month ago

We may close this as apparently Datacite reset regularly the test registry I'd rather not close this, and implement a resilient way to test our API client as Datacite test API has been capricious recently

alli83 commented 1 month ago

Looking at the DataciteApi, it seems possible to create a DOI in draft status within the test environment which allows for deletion as well. Therefore, I don't think we need a fake API