Introduce LoggedInTestMixin

There's a lot of copy-and-pasted code we can get rid of in our tests
now.