1441 |
ariadna |
1 |
@mod @mod_subsection
|
|
|
2 |
Feature: Testing subsection_access_restrictions in mod_subsection
|
|
|
3 |
In order restrict the access to subsections based on conditions
|
|
|
4 |
As a teacher
|
|
|
5 |
I need to set subsection conditions which prevent student access
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname |
|
|
|
10 |
| teacher1 | Teacher | 1 |
|
|
|
11 |
| student1 | Student | 1 |
|
|
|
12 |
| student2 | Student | 2 |
|
|
|
13 |
And the following "courses" exist:
|
|
|
14 |
| fullname | shortname | category | numsections | initsections |
|
|
|
15 |
| Course 1 | C1 | 0 | 2 | 1 |
|
|
|
16 |
And the following "course enrolments" exist:
|
|
|
17 |
| user | course | role |
|
|
|
18 |
| teacher1 | C1 | editingteacher |
|
|
|
19 |
| student1 | C1 | student |
|
|
|
20 |
| student2 | C1 | student |
|
|
|
21 |
And the following "groups" exist:
|
|
|
22 |
| course | name | idnumber |
|
|
|
23 |
| C1 | G1 | GI1 |
|
|
|
24 |
And the following "group members" exist:
|
|
|
25 |
| user | group |
|
|
|
26 |
| student1 | GI1 |
|
|
|
27 |
And the following "groupings" exist:
|
|
|
28 |
| name | course | idnumber |
|
|
|
29 |
| GX1 | C1 | GXI1 |
|
|
|
30 |
And the following "grouping groups" exist:
|
|
|
31 |
| grouping | group |
|
|
|
32 |
| GXI1 | GI1 |
|
|
|
33 |
And I log in as "teacher1"
|
|
|
34 |
|
|
|
35 |
Scenario: Teacher can set access restrictions to an existing subsection
|
|
|
36 |
Given the following "activities" exist:
|
|
|
37 |
| activity | name | course | idnumber | section |
|
|
|
38 |
| subsection | Subsection1 | C1 | Subsection1 | 1 |
|
|
|
39 |
| data | Subactivity | C1 | data1 | 3 |
|
|
|
40 |
When I am on the "C1 > Subsection1" "course > section settings" page
|
|
|
41 |
And I set the following fields to these values:
|
|
|
42 |
| Access restrictions | Grouping: GX1 |
|
|
|
43 |
And I press "Save changes"
|
|
|
44 |
Then I should see "Not available unless: You belong to a group in GX1"
|
|
|
45 |
And I log out
|
|
|
46 |
And I am on the "Course 1" "course" page logged in as "student1"
|
|
|
47 |
And I should see "Subsection1" in the "region-main" "region"
|
|
|
48 |
And I should see "Subactivity" in the "region-main" "region"
|
|
|
49 |
And I log out
|
|
|
50 |
And I am on the "Course 1" "course" page logged in as "student2"
|
|
|
51 |
And I should see "Not available unless: You belong to a group in GX1"
|
|
|
52 |
And I should not see "Subactivity"
|
|
|
53 |
|
|
|
54 |
Scenario: Teacher sets access restrictions to a new subsection
|
|
|
55 |
When I add a subsection activity to course "Course 1" section "1" and I fill the form with:
|
|
|
56 |
| Name | Subsection2 |
|
|
|
57 |
| Access restrictions | Grouping: GX1 |
|
|
|
58 |
Then I should see "Not available unless: You belong to a group in GX1"
|
|
|
59 |
And I log out
|
|
|
60 |
And I am on the "Course 1" "course" page logged in as "student1"
|
|
|
61 |
And I should see "Subsection2" in the "region-main" "region"
|
|
|
62 |
And I log out
|
|
|
63 |
And I am on the "Course 1" "course" page logged in as "student2"
|
|
|
64 |
And I should see "Subsection2" in the "region-main" "region"
|
|
|
65 |
And I should see "Not available unless: You belong to a group in GX1"
|