cuspaceflight/ruaumoko — pull request #19 by rjw57 (2014-10-18 16:18:19+00:00)
Title: Some unit tests! Testing the downloader.

OK, so there's a lot here. Essentially the PR has three parts:

1) Extend to downloader with the ability to save the original TIFF files. This isn't crucial functionality but if you want to re-generate the mock-data used in the test suite you'll need a similar tool. If ``--split-chunks`` is passed on the command line, the individual .tif files are saved rather than being concatenated into a single dataset. This is a bit of a hack but I found it useful.

2) Use the [responses](https://github.com/dropbox/responses) library from dropbox to mock the HTTP calls. We ship a (very) small set of 8x8 pixel TIFF DEM files down-sampled from the real data. This is a binary blob but it's only 13KiB. It can be re-generated using a script in the mock data directory. With the mock data we can make something like the DEM download server appear in the test suite without having to a) download 7GiB of data and b) actually run a HTTP server.

3) Use the mock server to exercise the downloader a little in the test suite. This required teaching the downloader about varying data sizes but that change is pretty small.

I've also added the plumbing to post code-coverage information to coveralls.io if it's set up for the repo.

Overall this is a lot of code churn to a tool which is used precisely once when setting up the server but it's all infrastructure which can now be used to *actually* test the server :).