[test-only] Api test. Checking X-Request-Id in response header (#6765)
* check X-Request-Id in response header * style
This commit is contained in:
@@ -201,7 +201,8 @@ class WebDavHelper {
|
|||||||
if ($folderDepth !== '0' && $folderDepth !== '1' && $folderDepth !== 'infinity') {
|
if ($folderDepth !== '0' && $folderDepth !== '1' && $folderDepth !== 'infinity') {
|
||||||
throw new InvalidArgumentException('Invalid depth value ' . $folderDepth);
|
throw new InvalidArgumentException('Invalid depth value ' . $folderDepth);
|
||||||
}
|
}
|
||||||
$headers = ['Depth' => $folderDepth];
|
$headers['Depth'] = $folderDepth;
|
||||||
|
$headers['X-Request-Id'] = WebDavHelper::generateUUIDv4();
|
||||||
return self::makeDavRequest(
|
return self::makeDavRequest(
|
||||||
$baseUrl,
|
$baseUrl,
|
||||||
$user,
|
$user,
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
@api
|
@api
|
||||||
Feature: Copy test
|
Feature: Copy test
|
||||||
As a user
|
As a user
|
||||||
I want to check the PROPFIND response
|
I want to check the PROPFIND response
|
||||||
So that I can make sure that the response contains all the relevant values
|
So that I can make sure that the response contains all the relevant values
|
||||||
|
|
||||||
|
|
||||||
Background:
|
Background:
|
||||||
Given these users have been created with default attributes and without skeleton files:
|
Given these users have been created with default attributes and without skeleton files:
|
||||||
@@ -22,3 +22,5 @@ Feature: Copy test
|
|||||||
And the following headers should match these regular expressions
|
And the following headers should match these regular expressions
|
||||||
| Oc-Fileid | /^[a-f0-9!\$\-]{110}$/ |
|
| Oc-Fileid | /^[a-f0-9!\$\-]{110}$/ |
|
||||||
| Access-Control-Allow-Origin | /^[*]{1}$/ |
|
| Access-Control-Allow-Origin | /^[*]{1}$/ |
|
||||||
|
| X-Request-Id | /^[a-f0-9!\-]{36}$/ |
|
||||||
|
|
||||||
@@ -18,6 +18,8 @@ Feature: Propfind test
|
|||||||
Given user "Alice" has uploaded a file inside space "new-space" with content "some content" to "testfile.txt"
|
Given user "Alice" has uploaded a file inside space "new-space" with content "some content" to "testfile.txt"
|
||||||
When user "Alice" sends PROPFIND request to space "new-space" using the WebDAV API
|
When user "Alice" sends PROPFIND request to space "new-space" using the WebDAV API
|
||||||
Then the HTTP status code should be "207"
|
Then the HTTP status code should be "207"
|
||||||
|
And the following headers should match these regular expressions
|
||||||
|
| X-Request-Id | /^[a-f0-9!\-]{36}$/ |
|
||||||
And the "PROPFIND" response should contain a space "new-space" with these key and value pairs:
|
And the "PROPFIND" response should contain a space "new-space" with these key and value pairs:
|
||||||
| key | value |
|
| key | value |
|
||||||
| oc:fileid | UUIDof:new-space |
|
| oc:fileid | UUIDof:new-space |
|
||||||
@@ -34,6 +36,8 @@ Feature: Propfind test
|
|||||||
| role | <role> |
|
| role | <role> |
|
||||||
When user "Brian" sends PROPFIND request to space "new-space" using the WebDAV API
|
When user "Brian" sends PROPFIND request to space "new-space" using the WebDAV API
|
||||||
Then the HTTP status code should be "207"
|
Then the HTTP status code should be "207"
|
||||||
|
And the following headers should match these regular expressions
|
||||||
|
| X-Request-Id | /^[a-f0-9!\-]{36}$/ |
|
||||||
And the "PROPFIND" response should contain a space "new-space" with these key and value pairs:
|
And the "PROPFIND" response should contain a space "new-space" with these key and value pairs:
|
||||||
| key | value |
|
| key | value |
|
||||||
| oc:fileid | UUIDof:new-space |
|
| oc:fileid | UUIDof:new-space |
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ Feature: REPORT request to Shares space
|
|||||||
And user "Brian" has accepted share "/folderMain" offered by user "Alice"
|
And user "Brian" has accepted share "/folderMain" offered by user "Alice"
|
||||||
When user "Brian" searches for "SubFolder1" using the WebDAV API
|
When user "Brian" searches for "SubFolder1" using the WebDAV API
|
||||||
Then the HTTP status code should be "207"
|
Then the HTTP status code should be "207"
|
||||||
|
And the following headers should match these regular expressions
|
||||||
|
| X-Request-Id | /^[a-f0-9!\-]{36}$/ |
|
||||||
And the "REPORT" response to user "Brian" should contain a mountpoint "folderMain" with these key and value pairs:
|
And the "REPORT" response to user "Brian" should contain a mountpoint "folderMain" with these key and value pairs:
|
||||||
| key | value |
|
| key | value |
|
||||||
| oc:fileid | UUIDof:SubFolder1 |
|
| oc:fileid | UUIDof:SubFolder1 |
|
||||||
@@ -40,6 +42,8 @@ Feature: REPORT request to Shares space
|
|||||||
And user "Alice" has uploaded file with content "Not all those who wander are lost." to "/folderMain/SubFolder1/subFOLDER2/frodo.txt"
|
And user "Alice" has uploaded file with content "Not all those who wander are lost." to "/folderMain/SubFolder1/subFOLDER2/frodo.txt"
|
||||||
When user "Brian" searches for "frodo.txt" using the WebDAV API
|
When user "Brian" searches for "frodo.txt" using the WebDAV API
|
||||||
Then the HTTP status code should be "207"
|
Then the HTTP status code should be "207"
|
||||||
|
And the following headers should match these regular expressions
|
||||||
|
| X-Request-Id | /^[a-f0-9!\-]{36}$/ |
|
||||||
And the "REPORT" response to user "Brian" should contain a mountpoint "folderMain" with these key and value pairs:
|
And the "REPORT" response to user "Brian" should contain a mountpoint "folderMain" with these key and value pairs:
|
||||||
| key | value |
|
| key | value |
|
||||||
| oc:fileid | UUIDof:SubFolder1/subFOLDER2/frodo.txt |
|
| oc:fileid | UUIDof:SubFolder1/subFOLDER2/frodo.txt |
|
||||||
@@ -59,6 +63,8 @@ Feature: REPORT request to Shares space
|
|||||||
Given using <dav-path-version> DAV path
|
Given using <dav-path-version> DAV path
|
||||||
When user "Brian" searches for "folderMain" using the WebDAV API
|
When user "Brian" searches for "folderMain" using the WebDAV API
|
||||||
Then the HTTP status code should be "207"
|
Then the HTTP status code should be "207"
|
||||||
|
And the following headers should match these regular expressions
|
||||||
|
| X-Request-Id | /^[a-f0-9!\-]{36}$/ |
|
||||||
And the search result should contain "0" entries
|
And the search result should contain "0" entries
|
||||||
Examples:
|
Examples:
|
||||||
| dav-path-version |
|
| dav-path-version |
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ Feature: REPORT request to project space
|
|||||||
And using new DAV path
|
And using new DAV path
|
||||||
When user "Alice" searches for "testFile.txt" using the WebDAV API
|
When user "Alice" searches for "testFile.txt" using the WebDAV API
|
||||||
Then the HTTP status code should be "207"
|
Then the HTTP status code should be "207"
|
||||||
|
And the following headers should match these regular expressions
|
||||||
|
| X-Request-Id | /^[a-f0-9!\-]{36}$/ |
|
||||||
And the "REPORT" response to user "Alice" should contain a mountpoint "findData" with these key and value pairs:
|
And the "REPORT" response to user "Alice" should contain a mountpoint "findData" with these key and value pairs:
|
||||||
| key | value |
|
| key | value |
|
||||||
| oc:fileid | UUIDof:testFile.txt |
|
| oc:fileid | UUIDof:testFile.txt |
|
||||||
@@ -35,6 +37,8 @@ Feature: REPORT request to project space
|
|||||||
And using new DAV path
|
And using new DAV path
|
||||||
When user "Alice" searches for "insideTheFolder.txt" using the WebDAV API
|
When user "Alice" searches for "insideTheFolder.txt" using the WebDAV API
|
||||||
Then the HTTP status code should be "207"
|
Then the HTTP status code should be "207"
|
||||||
|
And the following headers should match these regular expressions
|
||||||
|
| X-Request-Id | /^[a-f0-9!\-]{36}$/ |
|
||||||
And the "REPORT" response to user "Alice" should contain a mountpoint "findData" with these key and value pairs:
|
And the "REPORT" response to user "Alice" should contain a mountpoint "findData" with these key and value pairs:
|
||||||
| key | value |
|
| key | value |
|
||||||
| oc:fileid | UUIDof:folderMain/SubFolder1/subFOLDER2/insideTheFolder.txt |
|
| oc:fileid | UUIDof:folderMain/SubFolder1/subFOLDER2/insideTheFolder.txt |
|
||||||
@@ -50,6 +54,8 @@ Feature: REPORT request to project space
|
|||||||
And using new DAV path
|
And using new DAV path
|
||||||
When user "Alice" searches for "folderMain" using the WebDAV API
|
When user "Alice" searches for "folderMain" using the WebDAV API
|
||||||
Then the HTTP status code should be "207"
|
Then the HTTP status code should be "207"
|
||||||
|
And the following headers should match these regular expressions
|
||||||
|
| X-Request-Id | /^[a-f0-9!\-]{36}$/ |
|
||||||
And the "REPORT" response to user "Alice" should contain a mountpoint "findData" with these key and value pairs:
|
And the "REPORT" response to user "Alice" should contain a mountpoint "findData" with these key and value pairs:
|
||||||
| key | value |
|
| key | value |
|
||||||
| oc:fileid | UUIDof:folderMain |
|
| oc:fileid | UUIDof:folderMain |
|
||||||
@@ -64,6 +70,8 @@ Feature: REPORT request to project space
|
|||||||
Given user "Alice" has created a folder "folderMain/sub-folder" in space "findData"
|
Given user "Alice" has created a folder "folderMain/sub-folder" in space "findData"
|
||||||
And using new DAV path
|
And using new DAV path
|
||||||
When user "Alice" searches for "sub" using the WebDAV API
|
When user "Alice" searches for "sub" using the WebDAV API
|
||||||
|
And the following headers should match these regular expressions
|
||||||
|
| X-Request-Id | /^[a-f0-9!\-]{36}$/ |
|
||||||
Then the HTTP status code should be "207"
|
Then the HTTP status code should be "207"
|
||||||
And the "REPORT" response to user "Alice" should contain a mountpoint "findData" with these key and value pairs:
|
And the "REPORT" response to user "Alice" should contain a mountpoint "findData" with these key and value pairs:
|
||||||
| key | value |
|
| key | value |
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ Feature: Report test
|
|||||||
And user "Brian" has accepted share "/folderMain" offered by user "Alice"
|
And user "Brian" has accepted share "/folderMain" offered by user "Alice"
|
||||||
When user "Brian" searches for "SubFolder1" using the WebDAV API
|
When user "Brian" searches for "SubFolder1" using the WebDAV API
|
||||||
Then the HTTP status code should be "207"
|
Then the HTTP status code should be "207"
|
||||||
|
And the following headers should match these regular expressions
|
||||||
|
| X-Request-Id | /^[a-f0-9!\-]{36}$/ |
|
||||||
And the "REPORT" response to user "Brian" should contain a mountpoint "folderMain" with these key and value pairs:
|
And the "REPORT" response to user "Brian" should contain a mountpoint "folderMain" with these key and value pairs:
|
||||||
| key | value |
|
| key | value |
|
||||||
| oc:fileid | UUIDof:SubFolder1 |
|
| oc:fileid | UUIDof:SubFolder1 |
|
||||||
@@ -47,6 +49,8 @@ Feature: Report test
|
|||||||
And user "Brian" has accepted share "/folderMain" offered by user "Alice"
|
And user "Brian" has accepted share "/folderMain" offered by user "Alice"
|
||||||
When user "Brian" searches for "insideTheFolder.txt" using the WebDAV API
|
When user "Brian" searches for "insideTheFolder.txt" using the WebDAV API
|
||||||
Then the HTTP status code should be "207"
|
Then the HTTP status code should be "207"
|
||||||
|
And the following headers should match these regular expressions
|
||||||
|
| X-Request-Id | /^[a-f0-9!\-]{36}$/ |
|
||||||
And the "REPORT" response to user "Brian" should contain a mountpoint "folderMain" with these key and value pairs:
|
And the "REPORT" response to user "Brian" should contain a mountpoint "folderMain" with these key and value pairs:
|
||||||
| key | value |
|
| key | value |
|
||||||
| oc:fileid | UUIDof:SubFolder1/subFOLDER2/insideTheFolder.txt |
|
| oc:fileid | UUIDof:SubFolder1/subFOLDER2/insideTheFolder.txt |
|
||||||
@@ -65,4 +69,6 @@ Feature: Report test
|
|||||||
| role | viewer |
|
| role | viewer |
|
||||||
When user "Brian" searches for "folderMain" using the WebDAV API
|
When user "Brian" searches for "folderMain" using the WebDAV API
|
||||||
Then the HTTP status code should be "207"
|
Then the HTTP status code should be "207"
|
||||||
|
And the following headers should match these regular expressions
|
||||||
|
| X-Request-Id | /^[a-f0-9!\-]{36}$/ |
|
||||||
And the search result should contain "0" entries
|
And the search result should contain "0" entries
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ class SearchContext implements Context {
|
|||||||
$user = $this->featureContext->getActualUsername($user);
|
$user = $this->featureContext->getActualUsername($user);
|
||||||
$baseUrl = $this->featureContext->getBaseUrl();
|
$baseUrl = $this->featureContext->getBaseUrl();
|
||||||
$password = $this->featureContext->getPasswordForUser($user);
|
$password = $this->featureContext->getPasswordForUser($user);
|
||||||
|
$headers['X-Request-Id'] = WebDavHelper::generateUUIDv4();
|
||||||
$body
|
$body
|
||||||
= "<?xml version='1.0' encoding='utf-8' ?>\n" .
|
= "<?xml version='1.0' encoding='utf-8' ?>\n" .
|
||||||
" <oc:search-files xmlns:a='DAV:' xmlns:oc='http://owncloud.org/ns' >\n" .
|
" <oc:search-files xmlns:a='DAV:' xmlns:oc='http://owncloud.org/ns' >\n" .
|
||||||
@@ -83,7 +84,7 @@ class SearchContext implements Context {
|
|||||||
$password,
|
$password,
|
||||||
"REPORT",
|
"REPORT",
|
||||||
"/",
|
"/",
|
||||||
null,
|
$headers,
|
||||||
$this->featureContext->getStepLineRef(),
|
$this->featureContext->getStepLineRef(),
|
||||||
$body,
|
$body,
|
||||||
$this->featureContext->getDavPathVersion()
|
$this->featureContext->getDavPathVersion()
|
||||||
|
|||||||
@@ -1655,6 +1655,7 @@ class SpacesContext implements Context {
|
|||||||
):void {
|
):void {
|
||||||
$space = $this->getSpaceByName($user, $fromSpaceName);
|
$space = $this->getSpaceByName($user, $fromSpaceName);
|
||||||
$headers['Destination'] = $this->destinationHeaderValueWithSpaceName($user, $fileDestination, $toSpaceName);
|
$headers['Destination'] = $this->destinationHeaderValueWithSpaceName($user, $fileDestination, $toSpaceName);
|
||||||
|
$headers['X-Request-Id'] = WebDavHelper::generateUUIDv4();
|
||||||
$fullUrl = $space["root"]["webDavUrl"] . '/' . ltrim($fileSource, "/");
|
$fullUrl = $space["root"]["webDavUrl"] . '/' . ltrim($fileSource, "/");
|
||||||
$this->featureContext->setResponse($this->copyFilesAndFoldersRequest($user, $fullUrl, $headers));
|
$this->featureContext->setResponse($this->copyFilesAndFoldersRequest($user, $fullUrl, $headers));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user