-
Functional Test
-
Minor
-
Moodle 4.3
Docs
The relevant documentation for this feature can be found at Publish as LTI tool
Note: Member sync is covered by unit tests, however, it's probably a good idea to test manually to verify the tests are making the right assertions.
Prerequisites
Two sites are required for testing this feature and they must be able to communicate with one another.
- LTI platform (formerly known as consumer)
- LTI tool (formerly known as provider).
Important: If you're testing locally, you'll need to disable the 'Blocked hosts' setting in BOTH sites. You can find it in Site administration ► Security ► HTTP security. You'll need to clear the values and save. - In the platform site, create a course called "Platform course 1", with:
- 5 Students: s1, s2, s3, s4, s5
- 2 Teachers: t1 and t2
- In the tool site, create a course called "Tool course 1", with:
- An assignment called "Assign 1"
- An assignment called "Assign 2"
- A single teacher, t1, enrolled.
Register the tool and platform
- Following the docs linked above, specifically the section on Enabling the 'Publish as LTI tool' feature, enable the relevant plugins in the tool site.
- Following the docs linked above, specifically the section on Dynamic registration, create the tool-platform registration
- In the platform site, edit the preconfigured tool settings for the tool you just created
- Set "Tool configuration usage" to "Show in activity chooser and as a preconfigured tool"
- Set "IMS LTI Names and Role Provisioning" to "Use this service to retrieve members' information as per privacy settings"
- Change the name of the tool to "QA test tool"
- Save the tool configuration
Publish activities and set up platform resource links
- Log in to the tool site as a teacher t1
- Following the docs linked above, specifically the section on Sharing access to a course or activity, publish Assign 1 over LTI Advantage. When publishing, use the form defaults.
- Repeat the publishing process to publish Assign 2 over LTI Advantage also.
- Now log out of the tool.
- In the platform, log in as teacher t1
- Go to "Platform course 1"
- Add a label activity "Label 1" in section 1, setting completion to "students can manually mark this activity as complete"
- Click to add an activity/resource
- Select "QA test tool"
- Click "Select content"
- When prompted, open a new tab in the same browser session and log in to the tool site as the teacher, relaunching the Select content workflow when done (i.e. just close the modal and click "Select content" again)
- Continue to link your account
- When you see the listing of published activities, select the "Add to course" checkbox for Assign 1
- Click "Add content"
- Expand the "Privacy" section of the form and make sure "Share emails with the tool" and "share names with the tool" are both checked.
- Save the activity
- Repeat the process to create a resource link to "Assign 2" the same way.
- Verify both activities are created.
- Launch each activity (first launch allows the member sync to take place).
- On the course home, edit the "Assign 2" activity
- Add an access restriction based on activity completion "The activity Label 1 is marked complete"
- Save.
- Now, log out of the platform.
Link level memberships check
- Log into the platform as student s1
- Go to the course "Platform course 1"
- Verify you cannot access "Assign 2"
- Manually mark the label as complete.
- Verify you can now access "Assign 2"
- Launch "Assign 2"
- Verify you can view the assignment
- Now log out of the platform.
- Log in to the platform as user s2
- Go to the course "Platform course 1"
- Manually set the label "Label 1" as complete but DO NOT launch the "Assign 2" resource.
- Log out of the platform.
- Log in to the tool as the user t1
- Go to the course "Tool course 1"
- Go to participants
- Verify you see entries for users t1 and s1 from the platform, as follows:
- t1 will have 3 enrolment methods, one for each assignment (the enrol_lti methods) and one for the course (because they were manually enrolled there to begin with)
- s1 will have 1 enrolment method listed, for Assign 2 only.
- Stay on this page.
- Now, run the member sync task via cli (in the tool site).
php admin/cli/scheduled_task.php --execute='\enrol_lti\local\ltiadvantage\task\sync_members'
- Verify the task runs without any errors.
- Go back to the tool participants page and reload.
- Verify you now see the following enrolments:
- User s1 from the platform, with 2 enrolment methods "Assign 1" and "Assign 2"
- User s2 from the platform, with 2 enrolment methods "Assign 1" and "Assign 2"
- User s3 from the platform, with 1 enrolment methods "Assign 1"
- User s4 from the platform, with 1 enrolment methods "Assign 1"
- User s5 from the platform, with 1 enrolment methods "Assign 1"
- User t1 from the tool (remember, this user has their account linked during the content creation portion of the test), with 3 enrolment methods "Assign 1", "Assign 2" and manual.
- Now, log out of the tool
- Log into the tool as the admin user
- Go to the course "Tool course 1"
- Open "Assign 1" and select "Locally assigned roles" from the module settings menu ("More")
- Verify you only see 1 entry for the teacher. Other participants won't have role assignments until they launch the resource for the first time - this is expected.
- Go back and open "Assign 2" and select "Locally assigned roles" from module settings now.
- Verify you see 2 entries: 1 for the teacher and 1 for the platform user s1. Other participants won't have role assignments until they launch the resource for the first time - this is expected.
Mode "enrol and unenrol" (the default)
- Continuing on from above..
- Now, login to the platform as teacher t1
- Go to the course "Platform course 1"
- Enrol the user s6 as a student
- Unenrol user s5
- Now, run the member sync task via cli (in the tool site).
php admin/cli/scheduled_task.php --execute='\enrol_lti\local\ltiadvantage\task\sync_members'
- Verify the task runs without any errors.
- Go back to the tool participants page and reload.
- Verify:
- You don't see the user s5 listed any more
- You see user s6 listed with 1 enrolment method for "Assign 1".
Mode "enrol new"
- Continuing on from above..
- Login to the tool site as the teacher t1
- Go to course "Tool course 1"
- Click "Published as LTI Tools" in course setting
- Edit the published resource "Assign 1"
- Expand "Remote system" and set "user sync mode" to "Enrol new users"
- Save
- Now, login to the platform as teacher t1
- Go to the course "Platform course 1"
- Unenrol user s6
- Enrol user s7 as a student
- Now, run the member sync task via cli.
php admin/cli/scheduled_task.php --execute='\enrol_lti\local\ltiadvantage\task\sync_members'
- Verify the task runs without any errors.
- Go back to the tool participants page and reload.
- Verify:
- You still see the user s6 listed (i.e. they haven't been unenrolled)
- You see user s7 listed with 1 enrolment method for "Assign 1".
Mode "unenrol missing"
- Continuing on from above..
- Login to the tool site as the teacher t1
- Go to course "Tool course 1"
- Click "Published as LTI Tools" in course setting
- Edit the published resource "Assign 1"
- Expand "Remote system" and set "user sync mode" to "Unenrol missing"
- Save
- Now, login to the platform as teacher t1
- Go to the course "Platform course 1"
- Enrol user s8 as a student
- Now, run the member sync task via cli.
php admin/cli/scheduled_task.php --execute='\enrol_lti\local\ltiadvantage\task\sync_members'
- Verify the task runs without any errors.
- Go back to the tool participants page and reload.
- Verify:
- You don't see user s6 listed (i.e. they have been unenrolled)
- You see user s7 listed with 1 enrolment method for "Assign 1" (i.e. they haven't been unenrolled)
- You don't see user s8 listed (i.e. they haven't been enrolled)
Membership sync disabled
- Continuing on from above.
- Login to the tool site as the teacher t1
- Go to course "Tool course 1"
- Click "Published as LTI Tools" in course setting
- Edit the published resource "Assign 1"
- Expand "Remote system" and set "User sync mode" to "Enrol new and unenrol missing users"
- Save
- Edit again and set "user synchronisation" to "No"
- Save again
- Now, run the member sync task via cli.
php admin/cli/scheduled_task.php --execute='\enrol_lti\local\ltiadvantage\task\sync_members'
- Verify you don't see any task output mentioning syncing of memberships for resource 'Assign 1'.
- Go back to the tool participants page and reload.
- Verify:
- You still don't see user s8 listed (i.e. they haven't been enrolled)
- is a QA test written for
-
MDL-69542 LTI: Update tool provider feature to support 1.3
- Closed