Add tests for caching of permission results