-
Functional Test
-
Minor
-
Moodle 4.4
This test requires a Google client ID and secret and email address for use in testing.
- Log in as an admin and set up and configure the OAuth 2 Google service with a client ID and secret, as described in the documentation OAuth2 Services and OAuth 2 Google service.
- Give this service a name "Google for login" and the "Name displayed on the login page " just "Google". Set "This service will be used" to "Login page only".
- Configure another Google service with a name "Google Drive service". (You can set any client ID and secret, as they will not be used in this test). Set "This service will be used" to "Internal services only".
- Return to the services list page and make sure both services appear in the list and they appear as enabled for login and services respectively.
- Enable the OAuth 2 authentication plugin.
- In the manage authentication common settings, enable 'Prevent account creation when authenticating' (authpreventaccountcreation).
- Log out and go to the login page. Make sure you can only see one OAuth2 button and it says "Google".
- Try to log in with a Google account using the "Log in using your account on Google" button on the login page.
- Check that you can't.
- Log in as admin and disable 'Prevent account creation when authenticating' (authpreventaccountcreation).
- Log out again and try to log in with a Google account again.
- Check that you see a message saying that a confirmation email has been sent.
- Check you email and follow the link in the confirmation email.
- Check that an account is created with a picture and profile info from Google.
- Log in as admin and delete the account that you just created.
- Log in with another account which has no profile picture set.
- Go to your preferences page and click the link "Linked logins".
- Link a Google login to your Moodle account.
- Log out and verify you can log in to your Moodle account using your Google login.
- Check that the profile picture is updated to the one from Google.
- Change your profile picture to something else.
- Log out and log in again with the Google account.
- Check that your profile picture hasn't changed.
- Log in as admin and go to Site administration>Plugins>Repositories>Manage repositories. Enable the "Google Drive" plugin. In the plugin settings make sure that you only see "Google Driver service" in the "OAuth 2 service" dropdown. (You do not need to test the actual repository functionality here, as there is another QA test for it.)