Added unit tests for permissions