Fixed tests when user is the root.

Mocked read permissions in the unit tests.