Add tests for auto redirecting