MDL-45068 groups: fixes to group import

- If 'coursename' is specified in the CSV it should match the course short name - thanks Yusuf Yılmaz for the patch
- If 'idnumber' is specified but 'groupidnumber' is not, idnumber should be used for matching the course idnumber only
- If 'groupingname' is not specified, there should be no notices (regression from MDL-42514)
- If 'coursename' or 'idnumber' column is present, it can contain empty values in some/all lines
This commit is contained in:
Marina Glancy 2017-10-24 11:14:21 +08:00
parent 5bde2c2b62
commit ec43371a3f
3 changed files with 48 additions and 7 deletions

View file

@ -8,12 +8,14 @@ Feature: Importing of groups and groupings
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
| Course 2 | C2 | 0 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| teacher1 | C2 | editingteacher |
@javascript
Scenario: Import groups and groupings as teacher
@ -110,3 +112,32 @@ Feature: Importing of groups and groupings
And I press "Edit group settings"
And the field "id_idnumber" matches value ""
And I press "Cancel"
@javascript
Scenario: Import groups into multiple courses as a teacher
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Users > Groups" in current page administration
And I press "Import groups"
When I upload "group/tests/fixtures/groups_import_multicourse.csv" file to "Import" filemanager
And I press "Import groups"
Then I should see "Group group7 added successfully"
And I should see "Unknown course named \"C-non-existing\""
And I should see "Group group8 added successfully"
And I should not see "group-will-not-be-created"
And I should see "Group group9 added successfully"
And I should see "Group group10 added successfully"
And I press "Continue"
And I should see "group10"
And I should see "group7"
And I should see "group8"
And I should not see "group9"
And I should not see "group-will-not-be-created"
And I am on "Course 2" course homepage
And I navigate to "Users > Groups" in current page administration
And I should see "group9"
And I should not see "group-will-not-be-created"
And I should not see "group7"
And I should not see "group8"
And I should not see "group10"
And I log out

View file

@ -0,0 +1,6 @@
coursename,groupname
C1,group7
C-non-existing,group-will-not-be-created
C1,group8
C2,group9
,group10
1 coursename groupname
2 C1 group7
3 C-non-existing group-will-not-be-created
4 C1 group8
5 C2 group9
6 group10