1 |
efrain |
1 |
@core @core_backup
|
|
|
2 |
Feature: Restore Moodle 2 course backups with different user data settings
|
|
|
3 |
In order to decide upon including user data during backup and restore of courses
|
|
|
4 |
As a teacher and an admin
|
|
|
5 |
I need to be able to set and override backup and restore settings
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| student1 | Student | 1 | student1@example.com |
|
|
|
11 |
| teacher1 | Teacher | 1 | teacher1@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 "activities" exist:
|
|
|
20 |
| activity | name | intro | course | idnumber |
|
|
|
21 |
| data | Test database name | n | C1 | data1 |
|
|
|
22 |
And the following "mod_data > fields" exist:
|
|
|
23 |
| database | type | name | description |
|
|
|
24 |
| data1 | text | Test field name | Test field description |
|
|
|
25 |
And the following "mod_data > templates" exist:
|
|
|
26 |
| database | name |
|
|
|
27 |
| data1 | singletemplate |
|
|
|
28 |
| data1 | listtemplate |
|
|
|
29 |
| data1 | addtemplate |
|
|
|
30 |
| data1 | asearchtemplate |
|
|
|
31 |
| data1 | rsstemplate |
|
|
|
32 |
And the following "mod_data > entries" exist:
|
|
|
33 |
| database | user | Test field name |
|
|
|
34 |
| data1 | student1 | Student entry |
|
|
|
35 |
And the following config values are set as admin:
|
|
|
36 |
| enableasyncbackup | 0 |
|
|
|
37 |
And I log in as "admin"
|
|
|
38 |
And I backup "Course 1" course using this options:
|
|
|
39 |
| Initial | Include enrolled users | 1 |
|
|
|
40 |
| Confirmation | Filename | test_backup.mbz |
|
|
|
41 |
|
|
|
42 |
@javascript
|
|
|
43 |
Scenario: Restore a backup with user data
|
|
|
44 |
# "User data" marks the user data field for the section
|
|
|
45 |
# "-" marks the user data field for the data activity
|
|
|
46 |
When I restore "test_backup.mbz" backup into a new course using this options:
|
|
|
47 |
| Settings | Include enrolled users | 1 |
|
|
|
48 |
| Schema | User data | 1 |
|
|
|
49 |
| Schema | - | 1 |
|
|
|
50 |
Then I should see "Test database name"
|
|
|
51 |
When I click on "Test database name" "link" in the "region-main" "region"
|
|
|
52 |
Then I should see "Student entry"
|
|
|
53 |
|
|
|
54 |
@javascript
|
|
|
55 |
Scenario: Restore a backup without user data for data activity
|
|
|
56 |
# "User data" marks the user data field for the section
|
|
|
57 |
# "-" marks the user data field for the data activity
|
|
|
58 |
When I restore "test_backup.mbz" backup into a new course using this options:
|
|
|
59 |
| Settings | Include enrolled users | 1 |
|
|
|
60 |
| Schema | User data | 1 |
|
|
|
61 |
| Schema | - | 0 |
|
|
|
62 |
Then I should see "Test database name"
|
|
|
63 |
When I click on "Test database name" "link" in the "region-main" "region"
|
|
|
64 |
Then I should not see "Student entry"
|
|
|
65 |
|
|
|
66 |
@javascript
|
|
|
67 |
Scenario: Restore a backup without user data for section and data activity
|
|
|
68 |
# "User data" marks the user data field for the section
|
|
|
69 |
# "-" marks the user data field for the data activity
|
|
|
70 |
When I restore "test_backup.mbz" backup into a new course using this options:
|
|
|
71 |
| Settings | Include enrolled users | 1 |
|
|
|
72 |
| Schema | User data | 0 |
|
|
|
73 |
| Schema | - | 0 |
|
|
|
74 |
Then I should see "Test database name"
|
|
|
75 |
When I click on "Test database name" "link" in the "region-main" "region"
|
|
|
76 |
Then I should not see "Student entry"
|
|
|
77 |
|
|
|
78 |
@javascript
|
|
|
79 |
Scenario: Restore a backup without user data for section
|
|
|
80 |
# "User data" marks the user data field for the section
|
|
|
81 |
# "-" marks the user data field for the data activity
|
|
|
82 |
When I restore "test_backup.mbz" backup into a new course using this options:
|
|
|
83 |
| Settings | Include enrolled users | 1 |
|
|
|
84 |
| Schema | - | 1 |
|
|
|
85 |
| Schema | User data | 0 |
|
|
|
86 |
Then I should see "Test database name"
|
|
|
87 |
When I click on "Test database name" "link" in the "region-main" "region"
|
|
|
88 |
Then I should not see "Student entry"
|
|
|
89 |
|
|
|
90 |
@javascript
|
|
|
91 |
Scenario: Restore a backup with user data with local config for including users set to 0
|
|
|
92 |
And I restore "test_backup.mbz" backup into a new course using this options:
|
|
|
93 |
| Settings | Include enrolled users | 0 |
|
|
|
94 |
Then I should see "Test database name"
|
|
|
95 |
When I click on "Test database name" "link" in the "region-main" "region"
|
|
|
96 |
Then I should not see "Student entry"
|
|
|
97 |
|
|
|
98 |
@javascript
|
|
|
99 |
Scenario: Restore a backup with user data with site config for including users set to 0
|
|
|
100 |
Given I navigate to "Courses > Backups > General restore defaults" in site administration
|
|
|
101 |
And I set the field "s_restore_restore_general_users" to ""
|
|
|
102 |
And I press "Save changes"
|
|
|
103 |
And I am on the "Course 1" "restore" page
|
|
|
104 |
# "User data" marks the user data field for the section
|
|
|
105 |
# "-" marks the user data field for the data activity
|
|
|
106 |
And I restore "test_backup.mbz" backup into a new course using this options:
|
|
|
107 |
| Settings | Include enrolled users | 1 |
|
|
|
108 |
| Schema | User data | 1 |
|
|
|
109 |
| Schema | - | 1 |
|
|
|
110 |
Then I should see "Test database name"
|
|
|
111 |
When I click on "Test database name" "link" in the "region-main" "region"
|
|
|
112 |
Then I should see "Student entry"
|
|
|
113 |
|
|
|
114 |
@javascript
|
|
|
115 |
Scenario: Restore a backup with user data with local and site config config for including users set to 0
|
|
|
116 |
Given I navigate to "Courses > Backups > General restore defaults" in site administration
|
|
|
117 |
And I set the field "s_restore_restore_general_users" to ""
|
|
|
118 |
And I press "Save changes"
|
|
|
119 |
And I am on the "Course 1" "restore" page
|
|
|
120 |
When I restore "test_backup.mbz" backup into a new course using this options:
|
|
|
121 |
| Settings | Include enrolled users | 0 |
|
|
|
122 |
Then I should see "Test database name"
|
|
|
123 |
When I click on "Test database name" "link" in the "region-main" "region"
|
|
|
124 |
Then I should not see "Student entry"
|