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
initialising
tosuccessful
( orfailed
). - Error responses are returned for requests containing keywords:
POST /v1/jobs
with a target format ofunsupported
will return a 422POST /v1/imports
with a URL containingunknown
and 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.mp3
toexample.txt
- 2 - A successful conversion from
example.key
toexample-*.png
(multiple output files; with an export) - 3 - A failed conversion from
example.doc
toexample.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-mock
will not actually convert / import / export files.zamzar-mock
cannot 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-mock
are not guaranteed to be accurate. Please see the Zamzar API's Supported Conversions for the most up-to-date information.