MDL-87092 tool_uploaduser: suspend enrolments via CSV upload

This commit is contained in:
Kim Jared Lucas
2026-01-20 11:21:27 +08:00
parent 23ad73ee56
commit e195cb3905
3 changed files with 47 additions and 0 deletions
@@ -0,0 +1,41 @@
@tool @tool_uploaduser @_file_upload
Feature: Admin can suspend user course enrolment via CSV upload
In order to manage enrolments in bulk
As an administrator
I need to be able to enrol and suspend users using CSV upload
Background:
Given the following "courses" exist:
| fullname | shortname |
| Course 1 | C1 |
| Course 2 | C2 |
| Course 3 | C3 |
@javascript
Scenario: Admin uploads enrol and suspend CSVs and verifies enrolment status
Given I log in as "admin"
And I navigate to "Users > Accounts > Upload users" in site administration
When I upload "lib/tests/fixtures/QA_user_enrol.txt" file to "File" filemanager
And I press "Upload users"
And I press "Upload users"
And I press "Continue"
And I upload "lib/tests/fixtures/QA_user_suspend.txt" file to "File" filemanager
And I press "Upload users"
And I set the field "Upload type" to "Update existing users only"
And I press "Upload users"
And I press "Continue"
And I am on the "Course 1" "enrolled users" page
Then the following should exist in the "participants" table:
| First name | Status |
| Learner One | Active |
| Learner Two | Active |
And I am on the "Course 2" "enrolled users" page
And the following should exist in the "participants" table:
| First name | Status |
| Learner One | Active |
| Learner Two | Suspended |
And I am on the "Course 3" "enrolled users" page
And the following should exist in the "participants" table:
| First name | Status |
| Learner One | Suspended |
| Learner Two | Active |
+3
View File
@@ -0,0 +1,3 @@
username,firstname,lastname,email,course1,role1,course2,role2,course3,role3
learner1,Learner,One,[email protected],C1,student,C2,student,C3,student
learner2,Learner,Two,[email protected],C1,student,C2,student,C3,student
+3
View File
@@ -0,0 +1,3 @@
username,course1,role1,enrolstatus1,course2,role2,enrolstatus2,course3,role3,enrolstatus3
learner1,C1,student,0,C2,student,0,C3,student,1
learner2,C1,student,0,C2,student,1,C3,student,0