ga4gh-server icon indicating copy to clipboard operation
ga4gh-server copied to clipboard

Update protocol errors tests.

Open jeromekelleher opened this issue 8 years ago • 1 comments

Update `tests/unit/test_protocol_errors.pyto test all search endpoints. Run the tests usingnosetests -vs tests/unit/test_protocol_errors.py``.

  • Remove the TODO comment, and the check requestClass being in the set of supported methods. (Ignore comment about turning protocol.postMethods into a function).
  • Add a new test to check each search endpoint for InvalidJson. Sending malformed JSON like "[}" should result in an exceptions.MalformedJsonException.
  • Add a new test to check that sending a POST request to some suffixes of the valid search URLs will fail with an exceptions.PathNotFoundException (e.g. "/reads/search/xyz" should fail).
  • Add a new test to send requests in which the mimetype is not "application/json", and verify that these return exceptions.UnsupportedMediaTypeException
  • Add a new test to check that sending a GET request to the valid POST URLs results in a exceptions.MethodNotAllowedException.
  • More? There's lots of room to add tests here, as it's a good framework to work in. Go through the code in ga4gh/exceptions.py, ga4gh/frontend.py and ga4gh/backend.py and see what general exceptions can be provoked. Add tests for these here if they haven't already been covered.

jeromekelleher avatar Oct 08 '15 15:10 jeromekelleher

In action here: https://github.com/ga4gh/server/blob/1b1df9809ebe9a9bc6281a00de6ded9f90d43268/ga4gh/frontend.py#L829

david4096 avatar Oct 28 '16 00:10 david4096