From a1e1cf63fd81f22644adb2564f38345aee3a1d97 Mon Sep 17 00:00:00 2001 From: Michael Hawkins Date: Thu, 9 Aug 2018 16:29:07 +0800 Subject: [PATCH] MDL-62660 tool_dataprivacy: Behat additions for deletion and data expiry --- .../{dataexport.feature => datadelete.feature} | 53 +++++++++++++--------- .../dataprivacy/tests/behat/dataexport.feature | 36 ++++++++++++--- 2 files changed, 62 insertions(+), 27 deletions(-) copy admin/tool/dataprivacy/tests/behat/{dataexport.feature => datadelete.feature} (68%) diff --git a/admin/tool/dataprivacy/tests/behat/dataexport.feature b/admin/tool/dataprivacy/tests/behat/datadelete.feature similarity index 68% copy from admin/tool/dataprivacy/tests/behat/dataexport.feature copy to admin/tool/dataprivacy/tests/behat/datadelete.feature index 3ab0467f409..a7d94d6e7a2 100644 --- a/admin/tool/dataprivacy/tests/behat/dataexport.feature +++ b/admin/tool/dataprivacy/tests/behat/datadelete.feature @@ -1,8 +1,8 @@ @tool @tool_dataprivacy -Feature: Data export from the privacy API - In order to export data for users and meet legal requirements +Feature: Data delete from the privacy API + In order to delete data for users and meet legal requirements As an admin, user, or parent - I need to be able to export data for a user + I need to be able to request a user and their data data be deleted Background: Given the following "users" exist: @@ -19,14 +19,19 @@ Feature: Data export from the privacy API | user | role | contextlevel | reference | | parent | tired | User | victim | And the following config values are set as admin: - | contactdataprotectionofficer | 1 | tool_dataprivacy | + | contactdataprotectionofficer | 1 | tool_dataprivacy | @javascript - Scenario: As admin, export data for a user and download it - Given I log in as "admin" + Scenario: As admin, delete a user and their data + Given I log in as "victim" + And I should see "Victim User 1" + And I log out + + And I log in as "admin" And I navigate to "Users > Privacy and policies > Data requests" in site administration And I follow "New request" And I set the field "Requesting for" to "Victim User 1" + And I set the field "Type" to "Delete all of my personal data" And I press "Save changes" Then I should see "Victim User 1" And I should see "Pending" in the "Victim User 1" "table_row" @@ -39,22 +44,25 @@ Feature: Data export from the privacy API And I should see "Approved" in the "Victim User 1" "table_row" And I run all adhoc tasks And I reload the page - And I should see "Complete" in the "Victim User 1" "table_row" - And I follow "Actions" - And following "Download" should download between "1" and "100000" bytes + And I should see "Deleted" in the "Victim User 1" "table_row" + + And I log out + And I log in as "victim" + And I should see "Invalid login" @javascript - Scenario: As a student, request data export and then download it when approved + Scenario: As a student, request deletion of account and data Given I log in as "victim" And I follow "Profile" in the user menu And I follow "Data requests" And I follow "New request" + And I set the field "Type" to "Delete all of my personal data" And I press "Save changes" - Then I should see "Export all of my personal data" - And I should see "Pending" in the "Export all of my personal data" "table_row" + Then I should see "Delete all of my personal data" + And I should see "Pending" in the "Delete all of my personal data" "table_row" And I run all adhoc tasks And I reload the page - And I should see "Awaiting approval" in the "Export all of my personal data" "table_row" + And I should see "Awaiting approval" in the "Delete all of my personal data" "table_row" And I log out And I log in as "admin" @@ -67,20 +75,25 @@ Feature: Data export from the privacy API And I log in as "victim" And I follow "Profile" in the user menu And I follow "Data requests" - And I should see "Approved" in the "Export all of my personal data" "table_row" + And I should see "Approved" in the "Delete all of my personal data" "table_row" And I run all adhoc tasks And I reload the page - And I should see "Complete" in the "Export all of my personal data" "table_row" - And I follow "Actions" - And following "Download" should download between "1" and "100000" bytes + And I should see "Your session has timed out" + And I log in as "victim" + And I should see "Invalid login" + + And I log in as "admin" + And I navigate to "Users > Privacy and policies > Data requests" in site administration + And I should see "Deleted" @javascript - Scenario: As a parent, request data export for my child because I don't trust the little blighter + Scenario: As a parent, request account and data deletion for my child Given I log in as "parent" And I follow "Profile" in the user menu And I follow "Data requests" And I follow "New request" And I set the field "Requesting for" to "Victim User 1" + And I set the field "Type" to "Delete all of my personal data" And I press "Save changes" Then I should see "Victim User 1" And I should see "Pending" in the "Victim User 1" "table_row" @@ -102,6 +115,4 @@ Feature: Data export from the privacy API And I should see "Approved" in the "Victim User 1" "table_row" And I run all adhoc tasks And I reload the page - And I should see "Complete" in the "Victim User 1" "table_row" - And I follow "Actions" - And following "Download" should download between "1" and "100000" bytes + And I should see "You don't have any personal data requests" diff --git a/admin/tool/dataprivacy/tests/behat/dataexport.feature b/admin/tool/dataprivacy/tests/behat/dataexport.feature index 3ab0467f409..50c58bc2373 100644 --- a/admin/tool/dataprivacy/tests/behat/dataexport.feature +++ b/admin/tool/dataprivacy/tests/behat/dataexport.feature @@ -19,10 +19,11 @@ Feature: Data export from the privacy API | user | role | contextlevel | reference | | parent | tired | User | victim | And the following config values are set as admin: - | contactdataprotectionofficer | 1 | tool_dataprivacy | + | contactdataprotectionofficer | 1 | tool_dataprivacy | + | privacyrequestexpiry | 55 | tool_dataprivacy | @javascript - Scenario: As admin, export data for a user and download it + Scenario: As admin, export data for a user and download it, unless it has expired Given I log in as "admin" And I navigate to "Users > Privacy and policies > Data requests" in site administration And I follow "New request" @@ -39,12 +40,19 @@ Feature: Data export from the privacy API And I should see "Approved" in the "Victim User 1" "table_row" And I run all adhoc tasks And I reload the page - And I should see "Complete" in the "Victim User 1" "table_row" + And I should see "Download ready" in the "Victim User 1" "table_row" And I follow "Actions" And following "Download" should download between "1" and "100000" bytes + And the following config values are set as admin: + | privacyrequestexpiry | 1 | tool_dataprivacy | + And I wait "1" seconds + And I navigate to "Users > Privacy and policies > Data requests" in site administration + And I should see "Expired" in the "Victim User 1" "table_row" + And I follow "Actions" + And I should not see "Download" @javascript - Scenario: As a student, request data export and then download it when approved + Scenario: As a student, request data export and then download it when approved, unless it has expired Given I log in as "victim" And I follow "Profile" in the user menu And I follow "Data requests" @@ -70,10 +78,18 @@ Feature: Data export from the privacy API And I should see "Approved" in the "Export all of my personal data" "table_row" And I run all adhoc tasks And I reload the page - And I should see "Complete" in the "Export all of my personal data" "table_row" + And I should see "Download ready" in the "Export all of my personal data" "table_row" And I follow "Actions" And following "Download" should download between "1" and "100000" bytes + And the following config values are set as admin: + | privacyrequestexpiry | 1 | tool_dataprivacy | + And I wait "1" seconds + And I reload the page + + And I should see "Expired" in the "Export all of my personal data" "table_row" + And I should not see "Actions" + @javascript Scenario: As a parent, request data export for my child because I don't trust the little blighter Given I log in as "parent" @@ -102,6 +118,14 @@ Feature: Data export from the privacy API And I should see "Approved" in the "Victim User 1" "table_row" And I run all adhoc tasks And I reload the page - And I should see "Complete" in the "Victim User 1" "table_row" + And I should see "Download ready" in the "Victim User 1" "table_row" And I follow "Actions" And following "Download" should download between "1" and "100000" bytes + + And the following config values are set as admin: + | privacyrequestexpiry | 1 | tool_dataprivacy | + And I wait "1" seconds + And I reload the page + + And I should see "Expired" in the "Victim User 1" "table_row" + And I should not see "Actions" -- 2.11.4.GIT