Initial testing

This is a pull request to fix all *existing* tests in the project. It's not about writing new tests yet, just getting to a known 'good state'.

**Not ready to merge!**