From b522a23c200f0e5040b6906f0551e5301bd90cde Mon Sep 17 00:00:00 2001 From: Dipak Acharya Date: Thu, 30 May 2019 12:10:29 +0545 Subject: [PATCH] Add acceptance test for checking file access after recreating master key in encryption --- .drone.yml | 14 ++++++++++ tests/acceptance/config/behat.yml | 14 ++++++++++ .../webUIMasterKeys.feature | 28 +++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 tests/acceptance/features/webUIMasterKeyType/webUIMasterKeys.feature diff --git a/.drone.yml b/.drone.yml index 4343586e026f..1010c1156e80 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1581,3 +1581,17 @@ matrix: CONFIGURE_ENCRYPTION: true ENCRYPTION_TYPE: masterkey INSTALL_TESTING_APP: true + + ## encryption WebUI acceptance tests master-keys encryption + - PHP_VERSION: 7.1 + TEST_SUITE: webui + BEHAT_SUITE: webUIMasterKeyType + DB_TYPE: mariadb + USE_SERVER: true + SERVER_PROTOCOL: https + INSTALL_SERVER: true + CHOWN_SERVER: true + OWNCLOUD_LOG: true + CONFIGURE_ENCRYPTION: true + ENCRYPTION_TYPE: masterkey + INSTALL_TESTING_APP: true \ No newline at end of file diff --git a/tests/acceptance/config/behat.yml b/tests/acceptance/config/behat.yml index c2e35959222f..dd9dedc883e0 100644 --- a/tests/acceptance/config/behat.yml +++ b/tests/acceptance/config/behat.yml @@ -327,6 +327,20 @@ default: - WebUILoginContext: - WebUIPersonalGeneralSettingsContext: + # This suite is part of the encryption app in later core versions + webUIMasterKeyType: + paths: + - '%paths.base%/../features/webUIMasterKeyType' + contexts: + - EncryptionContext: + - WebUIAdminEncryptionSettingsContext: + - WebUIPersonalEncryptionSettingsContext: + - WebUIGeneralContext: + - WebUILoginContext: + - WebUIFilesContext: + - FeatureContext: *common_feature_context_params + - OccContext: + webUIMoveFilesFolders: paths: - '%paths.base%/../features/webUIMoveFilesFolders' diff --git a/tests/acceptance/features/webUIMasterKeyType/webUIMasterKeys.feature b/tests/acceptance/features/webUIMasterKeyType/webUIMasterKeys.feature new file mode 100644 index 000000000000..519c5e652b91 --- /dev/null +++ b/tests/acceptance/features/webUIMasterKeyType/webUIMasterKeys.feature @@ -0,0 +1,28 @@ +@webUI @skipOnEncryptionType:user-keys @skipOnStorage:ceph +Feature: encrypt files using master keys + As an admin + I want to be able to encrypt user files using master keys + So that I can use a common key to encrypt files of all user + + Scenario: user cannot access their file after recreating master key with re-login + Given user "user0" has been created with default attributes + And the administrator has set the encryption type to "masterkey" + And user "user0" has uploaded file "filesForUpload/textfile.txt" to "/somefile.txt" + And user "user0" has logged in using the webUI + When the administrator successfully recreates the encryption masterkey using the occ command + Then the command output should contain the text 'Note: All users are required to relogin.' + When the user opens file "lorem.txt" expecting to fail using the webUI + Then the user should be redirected to the general exception webUI page with the title "%productname%" + And the title of the exception on general exception webUI page should be "Forbidden" + And a message should be displayed on the general exception webUI page containing "Encryption not ready" + + Scenario: user can access their file after recreating master key with re-login + Given user "user0" has been created with default attributes + And the administrator has set the encryption type to "masterkey" + And user "user0" has uploaded file "filesForUpload/textfile.txt" to "/somefile.txt" + And user "user0" has logged in using the webUI + When the administrator successfully recreates the encryption masterkey using the occ command + And the user re-logs in as "user0" using the webUI + And the user opens file "lorem.txt" using the webUI + Then no dialog should be displayed on the webUI + And the user should be redirected to a webUI page with the title "Files - %productname%" \ No newline at end of file