Better test coverage for protect middleware