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.
To the first comment: External user groups are currently validated for uniqueness in an auth source, so you cannot have two user groups pointing to the same external user group.

To the second: I'll add a few possibly known exceptions that I'll test, and keep the handler for StandardError just in case for other cases. The reason being that we don't want to lock out an user in case there's some error we didn't handle and on login external user groups cannot be updated :smile: