1 |
efrain |
1 |
@mod @mod_lesson
|
|
|
2 |
Feature: A teacher can password protect a lesson
|
|
|
3 |
In order to avoid undesired accesses to lesson activities
|
|
|
4 |
As a teacher
|
|
|
5 |
I need to set a password to access the lesson
|
|
|
6 |
|
|
|
7 |
Scenario: Accessing as student to a protected lesson
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
11 |
| student1 | Student | 1 | student1@example.com |
|
|
|
12 |
And the following "courses" exist:
|
|
|
13 |
| fullname | shortname | category |
|
|
|
14 |
| Course 1 | C1 | 0 |
|
|
|
15 |
And the following "course enrolments" exist:
|
|
|
16 |
| user | course | role |
|
|
|
17 |
| teacher1 | C1 | editingteacher |
|
|
|
18 |
| student1 | C1 | student |
|
|
|
19 |
And the following "activity" exists:
|
|
|
20 |
| activity | lesson |
|
|
|
21 |
| course | C1 |
|
|
|
22 |
| idnumber | 0001 |
|
|
|
23 |
| name | Test lesson |
|
|
|
24 |
| usepassword | 1 |
|
|
|
25 |
| password | moodle_rules |
|
|
|
26 |
Given the following "mod_lesson > page" exist:
|
|
|
27 |
| lesson | qtype | title | content |
|
|
|
28 |
| Test lesson | content | First page name | First page contents |
|
|
|
29 |
And the following "mod_lesson > answer" exist:
|
|
|
30 |
| page | answer | jumpto |
|
|
|
31 |
| First page name | The first one | Next page |
|
|
|
32 |
When I am on the "Test lesson" "lesson activity" page logged in as student1
|
|
|
33 |
Then I should see "Test lesson is a password protected lesson"
|
|
|
34 |
And I should not see "First page contents"
|
|
|
35 |
And I set the field "userpassword" to "moodle"
|
|
|
36 |
And I press "Continue"
|
|
|
37 |
And I should see "Login failed, please try again..."
|
|
|
38 |
And I should see "Test lesson is a password protected lesson"
|
|
|
39 |
And I set the field "userpassword" to "moodle_rules"
|
|
|
40 |
And I press "Continue"
|
|
|
41 |
And I should see "First page contents"
|