OpenTreeMap / otm-ecoservice

REST services providing eco benefit calculations for OpenTreeMap
http://www.opentreemap.org
Other
20 stars 17 forks source link

Add full stack HTTP tests #28

Open jwalgran opened 10 years ago

jwalgran commented 10 years ago

We should have a few small tests that hit a fully running service to exercise the HTTP pipeline.

steventlamb commented 9 years ago

@jwalgran are you picturing something in the style of a 2-thread LiveServerTestCase making network requests, or an all-go solution that tests requests and response? The former sounds like a lot of work without a solution to grab off the shelf. The latter is well covered here: http://golang.org/pkg/net/http/httptest/#ResponseRecorder The latter would probably make this a duplicate of #25

jwalgran commented 9 years ago

The existing title and description may not be accurately capturing what we really need. Any set of REST services needs coverage around the interface to protect against regression. The three things we should strive to do are:

  1. Assert the existence/names of all the endpoints.
  2. Assert the shape and behavior of the request bodies and query string parameters.
  3. Assert the shape of the JSON responses.