Add tests for permissions.
pep8 cleanup