Skip to content

Commit

Permalink
Add new test suite apiAuthWebdav to drone
Browse files Browse the repository at this point in the history
  • Loading branch information
dpakach committed Dec 16, 2019
1 parent 103785c commit ddeb59d
Show file tree
Hide file tree
Showing 5 changed files with 159 additions and 11 deletions.
1 change: 1 addition & 0 deletions .drone.starlark
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ config = {
'suites': [
'apiAuth',
'apiAuthOcs',
'apiAuthWebDav',
'apiCapabilities',
'apiComments',
'apiFavorites',
Expand Down
147 changes: 147 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3912,6 +3912,152 @@ depends_on:
- phan-php7.2
- phan-php7.3

---
kind: pipeline
type: docker
name: apiAuthWebDav-mariadb10.2-php7.1

platform:
os: linux
arch: amd64

workspace:
base: /drone
path: src

steps:
- name: cache-restore
pull: always
image: plugins/s3-cache:1
settings:
access_key:
from_secret: cache_s3_access_key
endpoint:
from_secret: cache_s3_endpoint
restore: true
secret_key:
from_secret: cache_s3_secret_key
when:
instance:
- drone.owncloud.services
- drone.owncloud.com

- name: composer-install
pull: always
image: owncloudci/php:7.1
commands:
- make install-composer-deps
environment:
COMPOSER_HOME: /drone/src/.cache/composer

- name: vendorbin-install
pull: always
image: owncloudci/php:7.1
commands:
- make vendor-bin-deps
environment:
COMPOSER_HOME: /drone/src/.cache/composer

- name: yarn-install
pull: always
image: owncloudci/php:7.1
commands:
- make install-nodejs-deps
environment:
NPM_CONFIG_CACHE: /drone/src/.cache/npm
YARN_CACHE_FOLDER: /drone/src/.cache/yarn
bower_storage__packages: /drone/src/.cache/bower

- name: install-server
pull: always
image: owncloudci/php:7.1
commands:
- bash tests/drone/install-server.sh
- php occ a:l
- php occ config:system:set trusted_domains 1 --value=server
- php occ log:manage --level 2
- php occ config:list
- php occ security:certificates:import /drone/server.crt
- php occ security:certificates
environment:
DB_TYPE: mariadb

- name: install-extra-apps
pull: always
image: owncloudci/php:7.1
commands:
- git clone https://github.com/owncloud/testing.git /drone/src/apps/testing
- cd /drone/src/apps/testing
- composer install
- cd /drone/src
- php occ a:l
- php occ a:e testing
- php occ a:l

- name: fix-permissions
pull: always
image: owncloudci/php:7.1
commands:
- chown -R www-data /drone/src

- name: owncloud-log-server
pull: always
image: owncloud/ubuntu:18.04
detach: true
commands:
- tail -f /drone/src/data/owncloud.log

- name: acceptance-tests
pull: always
image: owncloudci/php:7.1
commands:
- touch /drone/saved-settings.sh
- . /drone/saved-settings.sh
- make test-acceptance-api
environment:
BEHAT_SUITE: apiAuthWebDav
TESTING_REMOTE_SYSTEM: true
TEST_SERVER_URL: https://server

services:
- name: mariadb
pull: always
image: mariadb:10.2
environment:
MYSQL_DATABASE: owncloud
MYSQL_PASSWORD: owncloud
MYSQL_ROOT_PASSWORD: owncloud
MYSQL_USER: owncloud

- name: server
pull: always
image: owncloudci/php:7.1
command:
- /usr/local/bin/apachectl
- -e
- debug
- -D
- FOREGROUND
environment:
APACHE_CONFIG_TEMPLATE: ssl
APACHE_SSL_CERT: /drone/server.crt
APACHE_SSL_CERT_CN: server
APACHE_SSL_KEY: /drone/server.key
APACHE_WEBROOT: /drone/src

trigger:
ref:
- refs/pull/**
- refs/tags/**
- refs/heads/master

depends_on:
- coding-standard-php7.3
- phpstan-php7.1
- phan-php7.1
- phan-php7.2
- phan-php7.3

---
kind: pipeline
type: docker
Expand Down Expand Up @@ -14553,6 +14699,7 @@ depends_on:
- phpunit-php7.1-sqlite-scality
- apiAuth-mariadb10.2-php7.1
- apiAuthOcs-mariadb10.2-php7.1
- apiAuthWebDav-mariadb10.2-php7.1
- apiCapabilities-mariadb10.2-php7.1
- apiComments-mariadb10.2-php7.1
- apiFavorites-mariadb10.2-php7.1
Expand Down
10 changes: 5 additions & 5 deletions tests/acceptance/features/apiAuthWebDav/webDavDELETEAuth.feature
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ Feature: delete file/folder
Scenario: send DELETE requests to another user's webDav endpoints as normal user
When user "user1" requests these endpoints with "DELETE" including body then the status codes should be as listed
| endpoint | http-code | body |
| /remote.php/webdav/textfile0.txt | 401 | doesnotmatter |
| /remote.php/dav/files/user0/textfile0.txt | 401 | doesnotmatter |
| /remote.php/webdav/PARENT | 401 | doesnotmatter |
| /remote.php/dav/files/user0/PARENT | 401 | doesnotmatter |
| /remote.php/dav/files/user0/PARENT/parent.txt | 401 | doesnotmatter |
| /remote.php/webdav/textfile0.txt | 404 | doesnotmatter |
| /remote.php/dav/files/user0/textfile0.txt | 404 | doesnotmatter |
| /remote.php/webdav/PARENT | 404 | doesnotmatter |
| /remote.php/dav/files/user0/PARENT | 404 | doesnotmatter |
| /remote.php/dav/files/user0/PARENT/parent.txt | 404 | doesnotmatter |

Scenario: send DELETE requests to webDav endpoints using invalid username but correct password
When user "usero" requests these endpoints with "DELETE" including body using the password of user "user0" then the status codes should be as listed
Expand Down
10 changes: 5 additions & 5 deletions tests/acceptance/features/apiAuthWebDav/webDavMOVEAuth.feature
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ Feature: MOVE file/folder
Scenario: send MOVE requests to another user's webDav endpoints as normal user
When user "user1" requests these endpoints with "MOVE" including body then the status codes should be as listed
| endpoint | http-code | body |
| /remote.php/webdav/textfile0.txt | 401 | doesnotmatter |
| /remote.php/dav/files/user0/textfile0.txt | 401 | doesnotmatter |
| /remote.php/webdav/PARENT | 401 | doesnotmatter |
| /remote.php/dav/files/user0/PARENT | 401 | doesnotmatter |
| /remote.php/dav/files/user0/PARENT/parent.txt | 401 | doesnotmatter |
| /remote.php/webdav/textfile0.txt | 403 | doesnotmatter |
| /remote.php/dav/files/user0/textfile0.txt | 403 | doesnotmatter |
| /remote.php/webdav/PARENT | 403 | doesnotmatter |
| /remote.php/dav/files/user0/PARENT | 403 | doesnotmatter |
| /remote.php/dav/files/user0/PARENT/parent.txt | 403 | doesnotmatter |

Scenario: send MOVE requests to webDav endpoints using invalid username but correct password
When user "usero" requests these endpoints with "MOVE" including body using the password of user "user0" then the status codes should be as listed
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/features/bootstrap/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ public function userRequestsURLWithUsingBasicAuth($user, $url, $method, $passwor
if ($password === null) {
$authString = "$user:" . $this->getPasswordForUser($user);
} else {
$authString = $password;
$authString = $user.":".$password;
}
$this->sendRequest(
$url, $method, 'basic ' . \base64_encode($authString), false, $body
Expand Down

0 comments on commit ddeb59d

Please sign in to comment.