mirrored from git://git.moodle.org/moodle.git
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDL-69231 tests: Improve existing role generator
Support definition of context levels and permissions.
- Loading branch information
1 parent
d0d7d57
commit 423e158
Showing
5 changed files
with
75 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,46 @@ | ||
@core @core_course @javascript | ||
@core @core_course | ||
Feature: Keyholder role is listed as course contact | ||
As a student I need to know who the keyholder is to enrol in a course | ||
|
||
Background: | ||
Given I log in as "admin" | ||
And I am on site homepage | ||
Given the following "roles" exist: | ||
| shortname | name | archetype | context_coursecat | context_course | enrol/self:holdkey | | ||
| keyholder | Keyholder | | 1 | 1 | allow | | ||
And the following "categories" exist: | ||
| name | category | idnumber | | ||
| Cat 1 | 0 | CAT1 | | ||
And I navigate to "Users > Permissions > Define roles" in site administration | ||
And I click on "Add a new role" "button" | ||
And I click on "Continue" "button" | ||
And I set the following fields to these values: | ||
| Short name | keyholder | | ||
| Custom full name | Keyholder | | ||
| contextlevel40 | 1 | | ||
| contextlevel50 | 1 | | ||
| enrol/self:holdkey | 1 | | ||
And I click on "Create this role" "button" | ||
And I navigate to "Appearance > Courses" in site administration | ||
And I click on "Keyholder" "checkbox" | ||
And I press "Save changes" | ||
And the following "users" exist: | ||
| username | firstname | lastname | email | | ||
| teacher1 | Teacher | 1 | teacher1@example.com | | ||
| keyholder1 | Keyholder | 1 | keyholder1@example.com | | ||
| student1 | Student | 1 | teacher1@example.com | | ||
| username | firstname | lastname | email | | ||
| teacher1 | Teacher | 1 | teacher1@example.com | | ||
| keyholder1 | Keyholder | 1 | keyholder1@example.com | | ||
| student1 | Student | 1 | teacher1@example.com | | ||
And the following "courses" exist: | ||
| fullname | shortname | format | coursedisplay | numsections | category | | ||
| Course 1 | C1 | topics | 0 | 5 | CAT1 | | ||
And I am on "Course 1" course homepage | ||
And I add "Self enrolment" enrolment method with: | ||
| Custom instance name | Test student enrolment | | ||
| Enrolment key | letmein | | ||
| Enrolment key | letmein | | ||
And I log out | ||
|
||
Scenario: Keyholder assigned to a course | ||
When I log in as "admin" | ||
And the following "course enrolments" exist: | ||
| user | course | role | | ||
| teacher1 | C1 | editingteacher | | ||
| keyholder1 | C1 | keyholder | | ||
And I log out | ||
And I log in as "student1" | ||
Given the following "course enrolments" exist: | ||
| user | course | role | | ||
| teacher1 | C1 | editingteacher | | ||
| keyholder1 | C1 | keyholder | | ||
When I log in as "student1" | ||
And I am on site homepage | ||
And I follow "Course 1" | ||
Then I should see "Keyholder 1" | ||
|
||
Scenario: Keyholder assigned to a category | ||
When I log in as "admin" | ||
And the following "role assigns" exist: | ||
| user | role | contextlevel | reference | | ||
| keyholder1 | keyholder | Category | CAT1 | | ||
Given the following "role assigns" exist: | ||
| user | role | contextlevel | reference | | ||
| keyholder1 | keyholder | Category | CAT1 | | ||
And the following "course enrolments" exist: | ||
| user | course | role | | ||
| teacher1 | C1 | editingteacher | | ||
And I log out | ||
And I log in as "student1" | ||
| user | course | role | | ||
| teacher1 | C1 | editingteacher | | ||
When I log in as "student1" | ||
And I am on site homepage | ||
And I follow "Course 1" | ||
Then I should see "Keyholder 1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters