Fixes required to make all unittests pass.
Small changes have been made to better deal with anonymous users,
allowing unittests to run without a logged in user required. Some small
changes have been made to the mock objects in tests, too, to catch up to
changes made in the API and server.