Fixes #7369 - External user groups update on login

This forces external user groups associated to the auth source of the user logging in to update, so that users get their external permissions updated on login.
Also there are a few unit tests that were large and I tried to tidy that up.