[#1879] Fix tests

The travis setup explicitly removes the `ckan.datastore.read_url`
setting when running the tests, so we need to use a dummy one.

Also some refactoring