New tests for views

Views are more thoroughly tested than before.

This allowed me to find a bug: when the design document already existed
in the database, the revision of the already existing document was not
set, which produced a conflict when saving.