]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add integration tests for creating shares with default expiration dates 24069/head
authorDaniel Calviño Sánchez <danxuliu@gmail.com>
Thu, 12 Nov 2020 10:52:53 +0000 (11:52 +0100)
committerDaniel Calviño Sánchez <danxuliu@gmail.com>
Mon, 16 Nov 2020 07:54:19 +0000 (08:54 +0100)
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
build/integration/features/bootstrap/SharingContext.php
build/integration/sharing_features/sharing-v1.feature

index 2fcca2ee2c72c6e5ab2e8f448272b00a58f60d40..b1a4c1aa48b9cce26427bcb2e27fc238f2fc5e41 100644 (file)
@@ -38,6 +38,12 @@ class SharingContext implements Context, SnippetAcceptingContext {
 
        protected function resetAppConfigs() {
                $this->deleteServerConfig('core', 'shareapi_default_permissions');
+               $this->deleteServerConfig('core', 'shareapi_default_internal_expire_date');
+               $this->deleteServerConfig('core', 'shareapi_internal_expire_after_n_days');
+               $this->deleteServerConfig('core', 'internal_defaultExpDays');
+               $this->deleteServerConfig('core', 'shareapi_default_expire_date');
+               $this->deleteServerConfig('core', 'shareapi_expire_after_n_days');
+               $this->deleteServerConfig('core', 'link_defaultExpDays');
                $this->deleteServerConfig('sharebymail', 'enforcePasswordProtection');
        }
 }
index 38eb2d8a812cc6fb33add913ff888dd0978f3c90..b5b4f5341afd97086dc620fb7972a6b955bd39d8 100644 (file)
@@ -391,6 +391,112 @@ Feature: sharing
     And Share fields of last share match with
       | permissions | 7 |
 
+  Scenario: Creating a new internal share with default expiration date
+    Given user "user0" exists
+    And user "user1" exists
+    And As an "user0"
+    And parameter "shareapi_default_internal_expire_date" of app "core" is set to "yes"
+    And parameter "shareapi_internal_expire_after_n_days" of app "core" is set to "3"
+    When creating a share with
+      | path | welcome.txt |
+      | shareWith | user1 |
+      | shareType | 0 |
+    And the OCS status code should be "100"
+    And the HTTP status code should be "200"
+    And Getting info of last share
+    Then the OCS status code should be "100"
+    And the HTTP status code should be "200"
+    And Share fields of last share match with
+      | expiration | +3 days |
+
+  Scenario: Creating a new internal share with relaxed default expiration date
+    Given user "user0" exists
+    And user "user1" exists
+    And As an "user0"
+    And parameter "shareapi_default_internal_expire_date" of app "core" is set to "yes"
+    And parameter "shareapi_internal_expire_after_n_days" of app "core" is set to "3"
+    And parameter "internal_defaultExpDays" of app "core" is set to "1"
+    When creating a share with
+      | path | welcome.txt |
+      | shareWith | user1 |
+      | shareType | 0 |
+    And the OCS status code should be "100"
+    And the HTTP status code should be "200"
+    And Getting info of last share
+    Then the OCS status code should be "100"
+    And the HTTP status code should be "200"
+    And Share fields of last share match with
+      | expiration | +1 days |
+
+  Scenario: Creating a new internal share with relaxed default expiration date too large
+    Given user "user0" exists
+    And user "user1" exists
+    And As an "user0"
+    And parameter "shareapi_default_internal_expire_date" of app "core" is set to "yes"
+    And parameter "shareapi_internal_expire_after_n_days" of app "core" is set to "3"
+    And parameter "internal_defaultExpDays" of app "core" is set to "10"
+    When creating a share with
+      | path | welcome.txt |
+      | shareWith | user1 |
+      | shareType | 0 |
+    And the OCS status code should be "100"
+    And the HTTP status code should be "200"
+    And Getting info of last share
+    Then the OCS status code should be "100"
+    And the HTTP status code should be "200"
+    And Share fields of last share match with
+      | expiration | +3 days |
+
+  Scenario: Creating a new link share with default expiration date
+    Given user "user0" exists
+    And As an "user0"
+    And parameter "shareapi_default_expire_date" of app "core" is set to "yes"
+    And parameter "shareapi_expire_after_n_days" of app "core" is set to "3"
+    When creating a share with
+      | path | welcome.txt |
+      | shareType | 3 |
+    And the OCS status code should be "100"
+    And the HTTP status code should be "200"
+    And Getting info of last share
+    Then the OCS status code should be "100"
+    And the HTTP status code should be "200"
+    And Share fields of last share match with
+      | expiration | +3 days |
+
+  Scenario: Creating a new link share with relaxed default expiration date
+    Given user "user0" exists
+    And As an "user0"
+    And parameter "shareapi_default_expire_date" of app "core" is set to "yes"
+    And parameter "shareapi_expire_after_n_days" of app "core" is set to "3"
+    And parameter "link_defaultExpDays" of app "core" is set to "1"
+    When creating a share with
+      | path | welcome.txt |
+      | shareType | 3 |
+    And the OCS status code should be "100"
+    And the HTTP status code should be "200"
+    And Getting info of last share
+    Then the OCS status code should be "100"
+    And the HTTP status code should be "200"
+    And Share fields of last share match with
+      | expiration | +1 days |
+
+  Scenario: Creating a new link share with relaxed default expiration date too large
+    Given user "user0" exists
+    And As an "user0"
+    And parameter "shareapi_default_expire_date" of app "core" is set to "yes"
+    And parameter "shareapi_expire_after_n_days" of app "core" is set to "3"
+    And parameter "link_defaultExpDays" of app "core" is set to "10"
+    When creating a share with
+      | path | welcome.txt |
+      | shareType | 3 |
+    And the OCS status code should be "100"
+    And the HTTP status code should be "200"
+    And Getting info of last share
+    Then the OCS status code should be "100"
+    And the HTTP status code should be "200"
+    And Share fields of last share match with
+      | expiration | +3 days |
+
   Scenario: getting all shares of a user using that user
     Given user "user0" exists
     And user "user1" exists