Skip to content

zamzar/zamzar-mock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zamzar Mock

@zamzar on Twitter Docker Pulls GitHub License

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.

Features

  • Support for all endpoints in the Zamzar API
  • Polling a job or import will cause it to advance through its lifecycle, from initialising to successful ( or failed).
  • Error responses are returned for requests containing keywords:
    • POST /v1/jobs with a target format of unsupported will return a 422
    • POST /v1/imports with a URL containing unknown 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 entirely
    • POST /v1/imports/ID/destroy - Remove an import entirely
    • POST /__admin/scenarios/reset - Reset the server to its initial state

Test Jobs

By default, zamzar-mock will boot with the following example jobs:

  • 1 - A successful conversion from example.mp3 to example.txt
  • 2 - A successful conversion from example.key to example-*.png (multiple output files; with an export)
  • 3 - A failed conversion from example.doc to example.pdf

Test Imports

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)

Test Files

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

Important Caveats

  • 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.

About

zamzar-mock is an HTTP server that acts like the real Zamzar API, making your tests less brittle

Resources

License

Stars

Watchers

Forks

Packages

No packages published