1 |
efrain |
1 |
@core @core_course
|
|
|
2 |
Feature: Access to downloading course content can be controlled
|
|
|
3 |
In order to allow or restrict access to download course content
|
|
|
4 |
As a trusted user
|
|
|
5 |
I can control access to the download course content feature
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
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 |
|
|
|
14 |
| Hockey 101 | C1 |
|
|
|
15 |
And the following "course enrolments" exist:
|
|
|
16 |
| user | course | role |
|
|
|
17 |
| teacher1 | C1 | editingteacher |
|
|
|
18 |
| student1 | C1 | student |
|
|
|
19 |
And the following config values are set as admin:
|
|
|
20 |
| downloadcoursecontentallowed | 1 |
|
|
|
21 |
|
|
|
22 |
Scenario: Site admins can remove the download course content feature
|
|
|
23 |
Given I log in as "admin"
|
|
|
24 |
And I am on "Hockey 101" course homepage
|
|
|
25 |
And I navigate to "Settings" in current page administration
|
|
|
26 |
And I set the field "Enable download course content" to "Yes"
|
|
|
27 |
And I press "Save and display"
|
|
|
28 |
Then "Download course content" "link" should exist in current page administration
|
|
|
29 |
When the following config values are set as admin:
|
|
|
30 |
| downloadcoursecontentallowed | 0 |
|
|
|
31 |
And I am on "Hockey 101" course homepage
|
|
|
32 |
Then "Download course content" "link" should not exist in current page administration
|
|
|
33 |
And I navigate to "Settings" in current page administration
|
|
|
34 |
And I should not see "Enable download course content"
|
|
|
35 |
|
|
|
36 |
Scenario: Site admins can set the default value for whether download course content is enabled in courses
|
|
|
37 |
Given I log in as "admin"
|
|
|
38 |
And I am on "Hockey 101" course homepage
|
|
|
39 |
And "Download course content" "link" should not exist in current page administration
|
|
|
40 |
When I navigate to "Courses > Default settings > Course default settings" in site administration
|
|
|
41 |
And I set the field "Enable download course content" to "Yes"
|
|
|
42 |
And I press "Save changes"
|
|
|
43 |
And I am on "Hockey 101" course homepage
|
|
|
44 |
Then "Download course content" "link" should exist in current page administration
|
|
|
45 |
|
|
|
46 |
Scenario: A teacher can enable and disable the download course content feature when it is available
|
|
|
47 |
Given I log in as "teacher1"
|
|
|
48 |
When I am on "Hockey 101" course homepage
|
|
|
49 |
And "Download course content" "link" should not exist in current page administration
|
|
|
50 |
And I navigate to "Settings" in current page administration
|
|
|
51 |
And I should see "Enable download course content"
|
|
|
52 |
And I set the field "Enable download course content" to "Yes"
|
|
|
53 |
And I press "Save and display"
|
|
|
54 |
Then "Download course content" "link" should exist in current page administration
|
|
|
55 |
And I navigate to "Settings" in current page administration
|
|
|
56 |
And I set the field "Enable download course content" to "No"
|
|
|
57 |
And I press "Save and display"
|
|
|
58 |
Then "Download course content" "link" should not exist in current page administration
|
|
|
59 |
|
|
|
60 |
Scenario: Teachers require a capability to access the download course content feature or modify its availability in a course
|
|
|
61 |
Given the following config values are set as admin:
|
|
|
62 |
| config | value | plugin |
|
|
|
63 |
| downloadcontentsitedefault | 1 | moodlecourse |
|
|
|
64 |
# Check teacher can see download option and enable dropdown.
|
|
|
65 |
And I log in as "teacher1"
|
|
|
66 |
And I am on "Hockey 101" course homepage
|
|
|
67 |
Then "Download course content" "link" should exist in current page administration
|
|
|
68 |
And I navigate to "Settings" in current page administration
|
|
|
69 |
And "Enable download course content" "select" should exist
|
|
|
70 |
# Remove teacher's capabilities for download course content.
|
|
|
71 |
And the following "role capability" exists:
|
|
|
72 |
| role | editingteacher |
|
|
|
73 |
| moodle/course:downloadcoursecontent | prohibit |
|
|
|
74 |
| moodle/course:configuredownloadcontent | prohibit |
|
|
|
75 |
# Check teacher can no longer see download option, and that enable value is visible, but dropdown no longer available.
|
|
|
76 |
When I log in as "teacher1"
|
|
|
77 |
And I am on "Hockey 101" course homepage
|
|
|
78 |
Then "Download course content" "link" should not exist in current page administration
|
|
|
79 |
And I navigate to "Settings" in current page administration
|
|
|
80 |
And I should see "Enable download course content"
|
|
|
81 |
And I should see "Site default (Yes)"
|
|
|
82 |
And "Enable download course content" "select" should not exist
|
|
|
83 |
|
|
|
84 |
Scenario: Students require a capability to access the download course content feature in a course
|
|
|
85 |
Given I log in as "teacher1"
|
|
|
86 |
And I am on "Hockey 101" course homepage
|
|
|
87 |
And I navigate to "Settings" in current page administration
|
|
|
88 |
And I set the field "Enable download course content" to "Yes"
|
|
|
89 |
And I press "Save and display"
|
|
|
90 |
And I log out
|
|
|
91 |
# Check student can see the download link.
|
|
|
92 |
And I log in as "student1"
|
|
|
93 |
And I am on "Hockey 101" course homepage
|
|
|
94 |
And "Download course content" "link" should exist in current page administration
|
|
|
95 |
# Remove student's capability for download course content.
|
|
|
96 |
When the following "role capability" exists:
|
|
|
97 |
| role | student |
|
|
|
98 |
| moodle/course:downloadcoursecontent | prohibit |
|
|
|
99 |
# Check student can no longer see the download link.
|
|
|
100 |
And I log in as "student1"
|
|
|
101 |
And I am on "Hockey 101" course homepage
|
|
|
102 |
Then "Download course content" "link" should not exist in current page administration
|