mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2025-12-23 22:29:59 -05:00
cleanup parallel deployment tests
Signed-off-by: prashant-gurung899 <prasantgrg777@gmail.com>
This commit is contained in:
7
Makefile
7
Makefile
@@ -86,7 +86,6 @@ help:
|
||||
@echo -e "${GREEN}Testing with test suite natively installed:${RESET}\n"
|
||||
@echo -e "${PURPLE}\tdocs: https://owncloud.dev/ocis/development/testing/#testing-with-test-suite-natively-installed${RESET}\n"
|
||||
@echo -e "\tmake test-acceptance-api\t\t${BLUE}run API acceptance tests${RESET}"
|
||||
@echo -e "\tmake test-paralleldeployment-api\t${BLUE}run API acceptance tests for parallel deployment${RESET}"
|
||||
@echo -e "\tmake clean-tests\t\t\t${BLUE}delete API tests framework dependencies${RESET}"
|
||||
@echo
|
||||
@echo -e "${BLACK}---------------------------------------------------------${RESET}"
|
||||
@@ -122,17 +121,11 @@ clean-tests:
|
||||
@rm -Rf vendor-bin/**/vendor vendor-bin/**/composer.lock tests/acceptance/output
|
||||
|
||||
BEHAT_BIN=vendor-bin/behat/vendor/bin/behat
|
||||
# behat config file for parallel deployment tests
|
||||
PARALLEL_BEHAT_YML=tests/parallelDeployAcceptance/config/behat.yml
|
||||
|
||||
.PHONY: test-acceptance-api
|
||||
test-acceptance-api: vendor-bin/behat/vendor
|
||||
BEHAT_BIN=$(BEHAT_BIN) tests/acceptance/run.sh
|
||||
|
||||
.PHONY: test-paralleldeployment-api
|
||||
test-paralleldeployment-api: vendor-bin/behat/vendor
|
||||
BEHAT_BIN=$(BEHAT_BIN) BEHAT_YML=$(PARALLEL_BEHAT_YML) tests/acceptance/run.sh
|
||||
|
||||
vendor/bamarni/composer-bin-plugin: composer.lock
|
||||
composer install
|
||||
|
||||
|
||||
@@ -419,56 +419,6 @@ BEHAT_FEATURE="tests/acceptance/features/apiSearchContent/contentSearch.feature"
|
||||
make test-acceptance-api
|
||||
```
|
||||
|
||||
## Running Tests for Parallel Deployment
|
||||
|
||||
### Setup the Parallel Deployment Environment
|
||||
|
||||
Instruction on setup is available [here](https://owncloud.dev/ocis/deployment/oc10_ocis_parallel/#local-setup)
|
||||
|
||||
Edit the `.env` file and uncomment this line:
|
||||
|
||||
```bash
|
||||
COMPOSE_FILE=docker-compose.yml:testing/docker-compose-additions.yml
|
||||
```
|
||||
|
||||
Start the docker stack with the following command:
|
||||
|
||||
```bash
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
### Getting the Test Helpers
|
||||
|
||||
All the test helpers are located in the core repo.
|
||||
|
||||
```bash
|
||||
git clone https://github.com/owncloud/core.git
|
||||
```
|
||||
|
||||
### Run the Acceptance Tests
|
||||
|
||||
Run the acceptance tests with the following command from the root of the oCIS repository:
|
||||
|
||||
```bash
|
||||
make test-paralleldeployment-api \
|
||||
TEST_SERVER_URL="https://cloud.owncloud.test" \
|
||||
TEST_OC10_URL="http://localhost:8080" \
|
||||
TEST_PARALLEL_DEPLOYMENT=true \
|
||||
TEST_WITH_LDAP=true \
|
||||
PATH_TO_CORE="<path_to_core>" \
|
||||
SKELETON_DIR="<path_to_core>/apps/testing/data/apiSkeleton"
|
||||
```
|
||||
|
||||
Replace `<path_to_core>` with the actual path to the root directory of core repo that you have cloned earlier.
|
||||
|
||||
In order to run a single test, use the `BEHAT_FEATURE` environment variable.
|
||||
|
||||
```bash
|
||||
make test-paralleldeployment-api \
|
||||
... \
|
||||
BEHAT_FEATURE="tests/parallelDeployAcceptance/features/apiShareManagement/acceptShares.feature"
|
||||
```
|
||||
|
||||
## Running Test Suite With Antivirus Service (@antivirus)
|
||||
Test suites that are tagged with `@antivirus` require antivirus service. The available antivirus and the configuration related to them can be found [here](https://doc.owncloud.com/ocis/next/deployment/services/s-list/antivirus.html). This documentation is only going to use `clamAv` as antivirus.
|
||||
|
||||
|
||||
@@ -42,23 +42,6 @@ use GuzzleHttp\Pool;
|
||||
class HttpRequestHelper {
|
||||
public const HTTP_TOO_EARLY = 425;
|
||||
public const HTTP_CONFLICT = 409;
|
||||
private static ?string $oCSelectorCookie = null;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public static function getOCSelectorCookie(): string {
|
||||
return self::$oCSelectorCookie;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $oCSelectorCookie "owncloud-selector=oc10;path=/;"
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function setOCSelectorCookie(string $oCSelectorCookie): void {
|
||||
self::$oCSelectorCookie = $oCSelectorCookie;
|
||||
}
|
||||
|
||||
/**
|
||||
* Some systems-under-test do async post-processing of operations like upload,
|
||||
@@ -409,20 +392,6 @@ class HttpRequestHelper {
|
||||
$headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
||||
}
|
||||
|
||||
if (OcisHelper::isTestingParallelDeployment()) {
|
||||
// oCIS cannot handle '/apps/testing' endpoints
|
||||
// so those requests must be redirected to oC10 server
|
||||
// change server to oC10 if the request url has `/apps/testing`
|
||||
if (strpos($url, "/apps/testing") !== false) {
|
||||
$oCISServerUrl = \getenv('TEST_SERVER_URL');
|
||||
$oC10ServerUrl = \getenv('TEST_OC10_URL');
|
||||
$url = str_replace($oCISServerUrl, $oC10ServerUrl, $url);
|
||||
} else {
|
||||
// set 'owncloud-server' selector cookie for oCIS requests
|
||||
$headers['Cookie'] = self::getOCSelectorCookie();
|
||||
}
|
||||
}
|
||||
|
||||
$request = new Request(
|
||||
$method,
|
||||
$url,
|
||||
|
||||
@@ -40,13 +40,6 @@ class OcisHelper {
|
||||
return (\getenv("TEST_REVA") === "true");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public static function isTestingParallelDeployment(): bool {
|
||||
return (\getenv("TEST_PARALLEL_DEPLOYMENT") === "true");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool|string false if no command given or the command as string
|
||||
*/
|
||||
|
||||
@@ -214,24 +214,6 @@ class FeatureContext extends BehatVariablesContext {
|
||||
return $this->useSharingNG;
|
||||
}
|
||||
|
||||
private string $oCSelector;
|
||||
|
||||
/**
|
||||
* @param string $selector
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setOCSelector(string $selector): void {
|
||||
$this->oCSelector = $selector;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getOCSelector(): string {
|
||||
return $this->oCSelector;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $httpStatusCode
|
||||
*
|
||||
@@ -502,9 +484,6 @@ class FeatureContext extends BehatVariablesContext {
|
||||
$this->cookieJar = new CookieJar();
|
||||
$this->ocPath = $ocPath;
|
||||
|
||||
// PARALLEL DEPLOYMENT: ownCloud selector
|
||||
$this->oCSelector = "oc10";
|
||||
|
||||
// These passwords are referenced in tests and can be overridden by
|
||||
// setting environment variables.
|
||||
$this->alt1UserPassword = "1234";
|
||||
|
||||
@@ -352,13 +352,6 @@ trait Provisioning {
|
||||
$this->ldap->bind();
|
||||
|
||||
$ldifFile = __DIR__ . $suiteParameters['ldapInitialUserFilePath'];
|
||||
if (OcisHelper::isTestingParallelDeployment()) {
|
||||
$behatYml = \getenv("BEHAT_YML");
|
||||
if ($behatYml) {
|
||||
$configPath = \dirname($behatYml);
|
||||
$ldifFile = $configPath . "/" . \basename($ldifFile);
|
||||
}
|
||||
}
|
||||
if (!$this->skipImportLdif) {
|
||||
$this->importLdifFile($ldifFile);
|
||||
}
|
||||
@@ -458,10 +451,6 @@ trait Provisioning {
|
||||
$entry['ownCloudUUID'] = WebDavHelper::generateUUIDv4();
|
||||
}
|
||||
|
||||
if (OcisHelper::isTestingParallelDeployment()) {
|
||||
$entry['ownCloudSelector'] = $this->getOCSelector();
|
||||
}
|
||||
|
||||
if ($this->federatedServerExists()) {
|
||||
if (!\in_array($setting['userid'], $this->ldapCreatedUsers)) {
|
||||
$this->ldap->add($newDN, $entry);
|
||||
|
||||
2
tests/parallelDeployAcceptance/.gitignore
vendored
2
tests/parallelDeployAcceptance/.gitignore
vendored
@@ -1,2 +0,0 @@
|
||||
!config
|
||||
output
|
||||
@@ -1,35 +0,0 @@
|
||||
default:
|
||||
autoload:
|
||||
"": "%paths.base%/../features/bootstrap"
|
||||
|
||||
suites:
|
||||
apiShareManagement:
|
||||
paths:
|
||||
- "%paths.base%/../features/apiShareManagement"
|
||||
context: &common_ldap_suite_context
|
||||
parameters:
|
||||
ldapAdminPassword: admin
|
||||
ldapUsersOU: TestUsers
|
||||
ldapGroupsOU: TestGroups
|
||||
ldapInitialUserFilePath: /ldap_users_groups.ldif
|
||||
contexts:
|
||||
- ParallelContext:
|
||||
- FeatureContext: &common_feature_context_params
|
||||
baseUrl: https://ocis:9200
|
||||
adminUsername: admin
|
||||
adminPassword: admin
|
||||
regularUserPassword: 1234
|
||||
ocPath: apps/testing/api/v1/occ
|
||||
|
||||
apiWebdavOperations:
|
||||
paths:
|
||||
- "%paths.base%/../features/apiWebdavOperations"
|
||||
context: *common_ldap_suite_context
|
||||
contexts:
|
||||
- ParallelContext:
|
||||
- FeatureContext: *common_feature_context_params
|
||||
|
||||
extensions:
|
||||
rdx\behatvars\BehatVariablesExtension: ~
|
||||
|
||||
Cjm\Behat\StepThroughExtension: ~
|
||||
@@ -1,7 +0,0 @@
|
||||
dn: ou=TestUsers,dc=owncloud,dc=com
|
||||
objectClass: organizationalUnit
|
||||
ou: TestUsers
|
||||
|
||||
dn: ou=TestGroups,dc=owncloud,dc=com
|
||||
objectClass: organizationalUnit
|
||||
ou: TestGroups
|
||||
@@ -1,32 +0,0 @@
|
||||
# This LDIF files describes the ownCloud schema
|
||||
dn: cn=owncloud,cn=schema,cn=config
|
||||
objectClass: olcSchemaConfig
|
||||
cn: owncloud
|
||||
olcObjectIdentifier: ownCloudOid 1.3.6.1.4.1.39430
|
||||
olcAttributeTypes: ( ownCloudOid:1.1.2 NAME 'ownCloudUUID'
|
||||
DESC 'A non-reassignable and persistent account ID)'
|
||||
EQUALITY uuidMatch
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.1.16.1 SINGLE-VALUE )
|
||||
olcAttributeTypes: ( ownCloudOid:1.1.3 NAME 'oCExternalIdentity'
|
||||
DESC 'A triple separated by "$" representing the objectIdentity resource type of the Graph API ( signInType $ issuer $ issuerAssignedId )'
|
||||
EQUALITY caseIgnoreMatch
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
|
||||
olcAttributeTypes: ( ownCloudOid:1.1.4 NAME 'ownCloudUserEnabled'
|
||||
DESC 'A boolean value indicating if ownCloudUser is enabled'
|
||||
EQUALITY booleanMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE)
|
||||
olcAttributeTypes: ( ownCloudOid:1.1.5 NAME 'ownCloudUserType'
|
||||
DESC 'User type (e.g. Member or Guest)'
|
||||
EQUALITY caseIgnoreMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE )
|
||||
olcObjectClasses: ( ownCloudOid:1.2.1 NAME 'ownCloud'
|
||||
DESC 'ownCloud LDAP Schema'
|
||||
AUXILIARY
|
||||
MAY ( ownCloudUUID ) )
|
||||
olcObjectClasses: ( ownCloudOid:1.2.2 NAME 'ownCloudUser'
|
||||
DESC 'ownCloud User LDAP Schema'
|
||||
SUP ownCloud
|
||||
AUXILIARY
|
||||
MAY ( ocExternalIdentity $ ownCloudUserEnabled $ ownCloudUserType ) )
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
echo "Writing custom config files..."
|
||||
|
||||
# openidconnect
|
||||
gomplate \
|
||||
-f /etc/templates/oidc.config.php \
|
||||
-o ${OWNCLOUD_VOLUME_CONFIG}/oidc.config.php
|
||||
|
||||
# we need at least version 2.1.0 of the openidconnect app
|
||||
occ market:upgrade --major openidconnect
|
||||
occ app:enable openidconnect
|
||||
|
||||
# user LDAP
|
||||
gomplate \
|
||||
-f /etc/templates/ldap-config.tmpl.json \
|
||||
-o ${OWNCLOUD_VOLUME_CONFIG}/ldap-config.json
|
||||
|
||||
CONFIG=$(cat ${OWNCLOUD_VOLUME_CONFIG}/ldap-config.json)
|
||||
occ config:import <<< $CONFIG
|
||||
|
||||
occ ldap:test-config "s01"
|
||||
occ app:enable user_ldap
|
||||
/bin/bash -c 'occ user:sync "OCA\User_LDAP\User_Proxy" -r -m remove'
|
||||
|
||||
occ market:upgrade --major web
|
||||
occ app:enable web
|
||||
|
||||
# enable testing app
|
||||
echo "Cloning and enabling testing app..."
|
||||
git clone --depth 1 https://github.com/owncloud/testing.git /var/www/owncloud/apps/testing
|
||||
occ app:enable testing
|
||||
|
||||
true
|
||||
@@ -1,53 +0,0 @@
|
||||
{
|
||||
"apps": {
|
||||
"user_ldap": {
|
||||
"s01has_memberof_filter_support": "0",
|
||||
"s01home_folder_naming_rule": "",
|
||||
"s01last_jpegPhoto_lookup": "0",
|
||||
"s01ldap_agent_password": "{{ .Env.STORAGE_LDAP_BIND_PASSWORD | base64.Encode }}",
|
||||
"s01ldap_attributes_for_group_search": "",
|
||||
"s01ldap_attributes_for_user_search": "{{ .Env.LDAP_USERATTRIBUTEFILTERS }}",
|
||||
"s01ldap_backup_host": "",
|
||||
"s01ldap_backup_port": "",
|
||||
"s01ldap_base_groups": "{{ .Env.LDAP_BASE_DN }}",
|
||||
"s01ldap_base_users": "{{ .Env.LDAP_BASE_DN }}",
|
||||
"s01ldap_base": "{{ .Env.LDAP_BASE_DN }}",
|
||||
"s01ldap_cache_ttl": "60",
|
||||
"s01ldap_configuration_active": "1",
|
||||
"s01ldap_display_name": "{{ .Env.LDAP_USER_SCHEMA_DISPLAYNAME }}",
|
||||
"s01ldap_dn": "{{ .Env.STORAGE_LDAP_BIND_DN }}",
|
||||
"s01ldap_dynamic_group_member_url": "",
|
||||
"s01ldap_email_attr": "{{ .Env.LDAP_USER_SCHEMA_MAIL }}",
|
||||
"s01ldap_experienced_admin": "1",
|
||||
"s01ldap_expert_username_attr": "{{ .Env.LDAP_USER_SCHEMA_NAME_ATTR }}",
|
||||
"s01ldap_expert_uuid_group_attr": "",
|
||||
"s01ldap_expert_uuid_user_attr": "{{ .Env.LDAP_USER_SCHEMA_UID }}",
|
||||
"s01ldap_group_display_name": "{{ .Env.LDAP_GROUP_SCHEMA_DISPLAYNAME }}",
|
||||
"s01ldap_group_filter_mode": "0",
|
||||
"s01ldap_group_filter": "{{ .Env.LDAP_GROUP_FILTER }}",
|
||||
"s01ldap_group_member_assoc_attribute": "{{ .Env.LDAP_GROUP_MEMBER_ASSOC_ATTR }}",
|
||||
"s01ldap_groupfilter_groups": "",
|
||||
"s01ldap_groupfilter_objectclass": "",
|
||||
"s01ldap_host": "{{ .Env.LDAP_HOST }}",
|
||||
"s01ldap_login_filter_mode": "0",
|
||||
"s01ldap_login_filter": "{{ .Env.LDAP_LOGINFILTER }}",
|
||||
"s01ldap_loginfilter_attributes": "",
|
||||
"s01ldap_loginfilter_email": "1",
|
||||
"s01ldap_loginfilter_username": "1",
|
||||
"s01ldap_nested_groups": "0",
|
||||
"s01ldap_override_main_server": "",
|
||||
"s01ldap_paging_size": "100",
|
||||
"s01ldap_port": "{{ .Env.LDAP_PORT }}",
|
||||
"s01ldap_quota_attr": "",
|
||||
"s01ldap_quota_def": "",
|
||||
"s01ldap_tls": "0",
|
||||
"s01ldap_turn_off_cert_check": "0",
|
||||
"s01ldap_user_display_name_2": "",
|
||||
"s01ldap_user_filter_mode": "0",
|
||||
"s01ldap_userfilter_groups": "",
|
||||
"s01ldap_userfilter_objectclass": "",
|
||||
"s01ldap_userlist_filter": "{{ .Env.LDAP_USER_FILTER }}",
|
||||
"s01use_memberof_to_detect_membership": "1"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
# reference: https://doc.owncloud.com/server/admin_manual/configuration/user/oidc/
|
||||
|
||||
function getOIDCConfigFromEnv() {
|
||||
$config = [
|
||||
'openid-connect' => [
|
||||
'provider-url' => getenv('IDP_OIDC_ISSUER'),
|
||||
'client-id' => 'oc10',
|
||||
'client-secret' => getenv('IDP_OIDC_CLIENT_SECRET'),
|
||||
'loginButtonName' => 'OpenId Connect',
|
||||
'search-attribute' => 'preferred_username',
|
||||
'mode' => 'userid',
|
||||
'autoRedirectOnLoginPage' => true,
|
||||
'insecure' => true,
|
||||
'post_logout_redirect_uri' => 'https://' . getenv('CLOUD_DOMAIN'),
|
||||
],
|
||||
];
|
||||
return $config;
|
||||
}
|
||||
|
||||
$CONFIG = getOIDCConfigFromEnv();
|
||||
@@ -1,61 +0,0 @@
|
||||
---
|
||||
policy_selector:
|
||||
claims:
|
||||
default_policy: oc10
|
||||
unauthenticated_policy: oc10
|
||||
policies:
|
||||
- name: ocis
|
||||
routes:
|
||||
- endpoint: /
|
||||
backend: http://localhost:9100
|
||||
- endpoint: /.well-known/
|
||||
backend: http://localhost:9130
|
||||
- endpoint: /konnect/
|
||||
backend: http://localhost:9130
|
||||
- endpoint: /signin/
|
||||
backend: http://localhost:9130
|
||||
- endpoint: /archiver
|
||||
backend: http://localhost:9140
|
||||
- type: regex
|
||||
endpoint: /ocs/v[12].php/cloud/user/signing-key
|
||||
backend: http://localhost:9110
|
||||
- endpoint: /ocs/
|
||||
backend: http://localhost:9140
|
||||
- type: query
|
||||
endpoint: /remote.php/?preview=1
|
||||
backend: http://localhost:9115
|
||||
- method: REPORT
|
||||
endpoint: /remote.php/dav/
|
||||
backend: http://localhost:9115
|
||||
- type: query
|
||||
endpoint: /dav/?preview=1
|
||||
backend: http://localhost:9115
|
||||
- type: query
|
||||
endpoint: /webdav/?preview=1
|
||||
backend: http://localhost:9115
|
||||
- endpoint: /remote.php/
|
||||
service: com.owncloud.web.ocdav
|
||||
- endpoint: /dav/
|
||||
service: com.owncloud.web.ocdav
|
||||
- endpoint: /webdav/
|
||||
service: com.owncloud.web.ocdav
|
||||
- endpoint: /status.php
|
||||
service: com.owncloud.web.ocdav
|
||||
- endpoint: /index.php/
|
||||
service: com.owncloud.web.ocdav
|
||||
- endpoint: /apps/
|
||||
service: com.owncloud.web.ocdav
|
||||
- endpoint: /data
|
||||
backend: http://localhost:9140
|
||||
- endpoint: /app/
|
||||
backend: http://localhost:9140
|
||||
- endpoint: /graph/
|
||||
backend: http://localhost:9120
|
||||
- endpoint: /api/v0/settings
|
||||
backend: http://localhost:9190
|
||||
- name: oc10
|
||||
routes:
|
||||
- endpoint: "/"
|
||||
backend: http://oc10:8080
|
||||
- endpoint: "/data"
|
||||
backend: http://localhost:9140
|
||||
@@ -1,6 +0,0 @@
|
||||
## Scenarios that are expected to fail in parallel deployment
|
||||
|
||||
The expected failures in this file are from features in the owncloud/ocis repo in the tests/parallelDeployAcceptance/features folder tree.
|
||||
|
||||
### [Cannot PROPFIND file information using ocis selector](https://github.com/owncloud/ocis/issues/4112)
|
||||
- [apiWebdavOperations/downloadFile.feature:35](https://github.com/owncloud/ocis/blob/master/tests/parallelDeployAcceptance/features/apiWebdavOperations/downloadFile.feature#L35)
|
||||
@@ -1,27 +0,0 @@
|
||||
Feature: sharing files and folders
|
||||
As a user
|
||||
I want to share files/folders with other users
|
||||
So that I can give access to my files/folders to others
|
||||
|
||||
|
||||
Background:
|
||||
Given using "oc10" as owncloud selector
|
||||
And using OCS API version "1"
|
||||
And using new DAV path
|
||||
And user "Alice" has been created with default attributes and without skeleton files
|
||||
And user "Brian" has been created with default attributes and without skeleton files
|
||||
And user "Alice" has uploaded file with content "ownCloud test text file" to "textfile.txt"
|
||||
|
||||
|
||||
Scenario: accept a pending share
|
||||
Given user "Alice" has sent the following resource share invitation:
|
||||
| resource | textfile.txt |
|
||||
| space | Personal |
|
||||
| sharee | Brian |
|
||||
| shareType | user |
|
||||
| permissionsRole | Editor |
|
||||
And user "Brian" has a share "textfile.txt" synced
|
||||
And using "ocis" as owncloud selector
|
||||
And the sharing API should report to user "Brian" that these shares are in the accepted state
|
||||
| path |
|
||||
| /Shares/textfile.txt |
|
||||
@@ -1,145 +0,0 @@
|
||||
Feature: download file
|
||||
As a user
|
||||
I want to be able to download files
|
||||
So that I can work with local copies of files on my client system
|
||||
|
||||
Background:
|
||||
Given using "oc10" as owncloud selector
|
||||
And user "Alice" has been created with default attributes and without skeleton files
|
||||
And user "Alice" has uploaded file with content "ownCloud test text file" to "textfile.txt"
|
||||
|
||||
|
||||
Scenario Outline: download a file
|
||||
Given using "ocis" as owncloud selector
|
||||
And using <dav-path-version> DAV path
|
||||
When user "Alice" downloads file "textfile.txt" using the WebDAV API
|
||||
Then the downloaded content should be "ownCloud test text file"
|
||||
Examples:
|
||||
| dav-path-version |
|
||||
| old |
|
||||
| new |
|
||||
|
||||
|
||||
Scenario Outline: download a file with range
|
||||
Given using "ocis" as owncloud selector
|
||||
And using <dav-path-version> DAV path
|
||||
When user "Alice" downloads file "textfile.txt" with range "bytes=0-7" using the WebDAV API
|
||||
Then the downloaded content should be "ownCloud"
|
||||
Examples:
|
||||
| dav-path-version |
|
||||
| old |
|
||||
| new |
|
||||
|
||||
|
||||
Scenario: Get the size of a file
|
||||
Given using "ocis" as owncloud selector
|
||||
When user "Alice" gets the size of file "textfile.txt" using the WebDAV API
|
||||
Then the HTTP status code should be "207"
|
||||
And the size of the file should be "23"
|
||||
|
||||
|
||||
Scenario Outline: Download a file with comma in the filename
|
||||
Given using <dav-path-version> DAV path
|
||||
And user "Alice" has uploaded file with content "file with comma in filename" to <filename>
|
||||
And using "ocis" as owncloud selector
|
||||
When user "Alice" downloads file <filename> using the WebDAV API
|
||||
Then the downloaded content should be "file with comma in filename"
|
||||
Examples:
|
||||
| dav-path-version | filename |
|
||||
| old | "sample,1.txt" |
|
||||
| old | ",,,.txt" |
|
||||
| old | ",,,.," |
|
||||
| new | "sample,1.txt" |
|
||||
| new | ",,,.txt" |
|
||||
| new | ",,,.," |
|
||||
|
||||
|
||||
Scenario Outline: download a file with single part ranges
|
||||
Given using "ocis" as owncloud selector
|
||||
And using <dav-path-version> DAV path
|
||||
When user "Alice" downloads file "textfile.txt" with range "bytes=0-7" using the WebDAV API
|
||||
Then the HTTP status code should be "206"
|
||||
And the following headers should be set
|
||||
| header | value |
|
||||
| Content-Length | 8 |
|
||||
| Content-Range | bytes 0-7/23 |
|
||||
And the downloaded content should be "ownCloud"
|
||||
Examples:
|
||||
| dav-path-version |
|
||||
| old |
|
||||
| new |
|
||||
|
||||
|
||||
Scenario Outline: download a file with last byte range out of bounds
|
||||
Given using "ocis" as owncloud selector
|
||||
And using <dav-path-version> DAV path
|
||||
When user "Alice" downloads file "textfile.txt" with range "bytes=0-24" using the WebDAV API
|
||||
Then the HTTP status code should be "206"
|
||||
And the downloaded content should be "ownCloud test text file"
|
||||
Examples:
|
||||
| dav-path-version |
|
||||
| old |
|
||||
| new |
|
||||
|
||||
|
||||
Scenario Outline: download a range at the end of a file
|
||||
Given using "ocis" as owncloud selector
|
||||
And using <dav-path-version> DAV path
|
||||
When user "Alice" downloads file "textfile.txt" with range "bytes=-4" using the WebDAV API
|
||||
Then the HTTP status code should be "206"
|
||||
And the downloaded content should be "file"
|
||||
Examples:
|
||||
| dav-path-version |
|
||||
| old |
|
||||
| new |
|
||||
|
||||
|
||||
Scenario Outline: download a file with range out of bounds
|
||||
Given using "ocis" as owncloud selector
|
||||
And using <dav-path-version> DAV path
|
||||
When user "Alice" downloads file "textfile.txt" with range "bytes=24-30" using the WebDAV API
|
||||
Then the HTTP status code should be "416"
|
||||
Examples:
|
||||
| dav-path-version |
|
||||
| old |
|
||||
| new |
|
||||
|
||||
|
||||
Scenario Outline: download a hidden file
|
||||
Given using <dav-path-version> DAV path
|
||||
And user "Alice" has created folder "FOLDER"
|
||||
And user "Alice" has uploaded the following files with content "hidden file"
|
||||
| path |
|
||||
| .hidden_file |
|
||||
| FOLDER/.hidden_file |
|
||||
And using "ocis" as owncloud selector
|
||||
When user "Alice" downloads file ".hidden_file" using the WebDAV API
|
||||
Then the HTTP status code should be "200"
|
||||
And the downloaded content should be "hidden file"
|
||||
When user "Alice" downloads file "FOLDER/.hidden_file" using the WebDAV API
|
||||
Then the HTTP status code should be "200"
|
||||
And the downloaded content should be "hidden file"
|
||||
Examples:
|
||||
| dav-path-version |
|
||||
| old |
|
||||
| new |
|
||||
|
||||
|
||||
Scenario Outline: Downloading a file should serve security headers
|
||||
Given using "ocis" as owncloud selector
|
||||
And using <dav-path-version> DAV path
|
||||
When user "Alice" downloads file "textfile.txt" using the WebDAV API
|
||||
Then the following headers should be set
|
||||
| header | value |
|
||||
| Content-Disposition | attachment; filename*=UTF-8''textfile.txt; filename="textfile.txt" |
|
||||
| Content-Security-Policy | child-src 'self'; connect-src 'self'; default-src 'none'; font-src 'self'; frame-ancestors 'self'; frame-src 'self' blob: https://embed.diagrams.net/; img-src 'self' data: blob:; manifest-src 'self'; media-src 'self'; object-src 'self' blob:; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline' |
|
||||
| X-Content-Type-Options | nosniff |
|
||||
| X-Download-Options | noopen |
|
||||
| X-Frame-Options | SAMEORIGIN |
|
||||
| X-Permitted-Cross-Domain-Policies | none |
|
||||
| X-Robots-Tag | none |
|
||||
| X-XSS-Protection | 1; mode=block |
|
||||
Examples:
|
||||
| dav-path-version |
|
||||
| old |
|
||||
| new |
|
||||
@@ -1,70 +0,0 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* ownCloud
|
||||
*
|
||||
* @author Sajan Gurung <sajan@jankaritech.com>
|
||||
* @copyright Copyright (c) 2021 Sajan Gurung sajan@jankaritech.com
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License,
|
||||
* as published by the Free Software Foundation;
|
||||
* either version 3 of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
use Behat\Behat\Context\Context;
|
||||
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
|
||||
use TestHelpers\SetupHelper;
|
||||
use TestHelpers\HttpRequestHelper;
|
||||
|
||||
require_once 'bootstrap.php';
|
||||
|
||||
/**
|
||||
* Steps related to parallel deploy setup
|
||||
*/
|
||||
class ParallelContext implements Context {
|
||||
/**
|
||||
* @var FeatureContext
|
||||
*/
|
||||
private FeatureContext $featureContext;
|
||||
|
||||
/**
|
||||
* @BeforeScenario
|
||||
*
|
||||
* @param BeforeScenarioScope $scope
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function setUpScenario(BeforeScenarioScope $scope): void {
|
||||
$environment = $scope->getEnvironment();
|
||||
$this->featureContext = $environment->getContext('FeatureContext');
|
||||
SetupHelper::init(
|
||||
$this->featureContext->getAdminUsername(),
|
||||
$this->featureContext->getAdminPassword(),
|
||||
$this->featureContext->getBaseUrl(),
|
||||
$this->featureContext->getOcPath()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given using :selector as owncloud selector
|
||||
*
|
||||
* @param string $selector 'ocis' or 'oc10'
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function usingOwncloudSelector(string $selector): void {
|
||||
$this->featureContext->setOCSelector($selector);
|
||||
HttpRequestHelper::setOCSelectorCookie("owncloud-selector=$selector;path=/;");
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php declare(strict_types=1);
|
||||
/**
|
||||
* ownCloud
|
||||
*
|
||||
* @author Phil Davis <phil@jankaritech.com>
|
||||
* @copyright Copyright (c) 2020 Phil Davis phil@jankaritech.com
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License,
|
||||
* as published by the Free Software Foundation;
|
||||
* either version 3 of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
use Composer\Autoload\ClassLoader;
|
||||
|
||||
$classLoader = new ClassLoader();
|
||||
$classLoader->addPsr4(
|
||||
"",
|
||||
__DIR__ . "/../../../tests/acceptance/features/bootstrap",
|
||||
true
|
||||
);
|
||||
|
||||
$classLoader->addPsr4("TestHelpers\\", __DIR__ . "/../../../TestHelpers", true);
|
||||
$classLoader->register();
|
||||
Reference in New Issue
Block a user