Add tests, pt. ii

Factor out some bits to a test base module.
Add PermissionsRegistry.require()

This can be used on a view like
`@permissions.require('can_do_whatever')` instead of doing
`@permissions.can_do_whatever`. The main advantage is that it side
steps the issue of name conflicts between permission names and registry
attributes.