1 |
efrain |
1 |
@enrol @enrol_self
|
|
|
2 |
Feature: Users can be defined as key holders in courses where self enrolment is allowed
|
|
|
3 |
In order to participate in courses
|
|
|
4 |
As a user
|
|
|
5 |
I need to auto enrol me in courses
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "roles" exist:
|
|
|
9 |
| shortname | name | context_course | enrol/self:holdkey |
|
|
|
10 |
| keyholder | Key holder | 1 | allow |
|
|
|
11 |
And the following "users" exist:
|
|
|
12 |
| username | firstname | lastname | email |
|
|
|
13 |
| manager1 | Manager | 1 | manager1@example.com |
|
|
|
14 |
| student1 | Student | 1 | student1@example.com |
|
|
|
15 |
And the following "courses" exist:
|
|
|
16 |
| fullname | shortname | format |
|
|
|
17 |
| Course 1 | C1 | topics |
|
|
|
18 |
And I log in as "admin"
|
|
|
19 |
And I navigate to "Appearance > Courses" in site administration
|
|
|
20 |
And I set the following fields to these values:
|
|
|
21 |
| Key holder | 1 |
|
|
|
22 |
And I press "Save changes"
|
|
|
23 |
And the following "course enrolments" exist:
|
|
|
24 |
| user | course | role |
|
|
|
25 |
| manager1 | C1 | keyholder |
|
|
|
26 |
And I log out
|
|
|
27 |
|
|
|
28 |
@javascript
|
|
|
29 |
Scenario: The key holder name is displayed on site home page
|
|
|
30 |
Given I log in as "admin"
|
|
|
31 |
When I add "Self enrolment" enrolment method in "Course 1" with:
|
|
|
32 |
| Custom instance name | Test student enrolment |
|
|
|
33 |
| Enrolment key | moodle_rules |
|
|
|
34 |
And I log out
|
|
|
35 |
And I log in as "student1"
|
|
|
36 |
And I am on "Course 1" course homepage
|
|
|
37 |
And I should see "You should have received this enrolment key from:"
|
|
|
38 |
And I should see "Manager 1"
|
|
|
39 |
And I set the following fields to these values:
|
|
|
40 |
| Enrolment key | moodle_rules |
|
|
|
41 |
And I press "Enrol me"
|
|
|
42 |
Then I should see "New section"
|
|
|
43 |
And I should not see "Enrolment options"
|
|
|
44 |
And I should not see "Enrol me in this course"
|