nit: I'd prefer to see RequestFactory used here. Your tests will run faster. You won't have to worry about following redirects from middleware that doesn't need to be executed in a unit test. Your code will be even more beautiful. :)