Add some tests for the user controller

I'd suggest pulling out the merge of #270 and then merging this along with it all in one go.

@alastairs: I'd like an opinion on some of these, as a few of them feel like I'm testing just the implementation.