zamzar-mock is an HTTP server that acts like the real Zamzar API, making your tests less brittle.
Run with:
docker run --rm --name zamzar-mock -p 8080:8080 zamzar/zamzar-mock
Then issue API requests as follows:
curl http://localhost:8080/v1/jobs/1 -H 'Authorization: Bearer GiVUYsF4A8ssq93FR48H'
For more information on available endpoints, please see the Zamzar API documentation.
- Support for all endpoints in the Zamzar API
- Polling a job or import will cause it to advance through its lifecycle, from
initialisingtosuccessful( orfailed). - Error responses are returned for requests containing keywords:
POST /v1/jobswith a target format ofunsupportedwill return a 422POST /v1/importswith a URL containingunknownand no filename will return a 422 (implying that the URL's filename cannot be inferred)
- Additional endpoints for testing:
POST /v1/jobs/ID/destroy- Remove a job entirelyPOST /v1/imports/ID/destroy- Remove an import entirelyPOST /__admin/scenarios/reset- Reset the server to its initial state
By default, zamzar-mock will boot with the following example jobs:
- 1 - A successful conversion from
example.mp3toexample.txt - 2 - A successful conversion from
example.keytoexample-*.png(multiple output files; with an export) - 3 - A failed conversion from
example.doctoexample.pdf
By default, zamzar-mock will boot with the following example imports:
- 1 - A successful import of
example.mp3 - 2 - A failed import of
example.doc(due to a file size limit) - 3 - A failed import of
example.doc(due to a credentials error)
By default, zamzar-mock will boot with:
- at least 7 example files
- a file with the special ID 0 that is large (256MB) and cannot be deleted
zamzar-mockwill not actually convert / import / export files.zamzar-mockcannot create new jobs or imports (though it will return a 2xx response for any POST request that would create a resource in the real API).- The formats, conversions and credit costs provided by
zamzar-mockare not guaranteed to be accurate. Please see the Zamzar API's Supported Conversions for the most up-to-date information.