fix after review

This commit is contained in:
Viktor Scharf committed 2022-12-22 10:29:36 +01:00
1 parent 4de7499ce6
commit fb3d7b7bff
2 files changed
+4 -39

No files matched your search

@@ -9,14 +9,13 @@ Feature: Copy test
And using spaces DAV path And using spaces DAV path
And the administrator has given "Alice" the role "Space Admin" using the settings api And the administrator has given "Alice" the role "Space Admin" using the settings api
And user "Alice" has created a space "new-space" with the default quota using the GraphApi And user "Alice" has created a space "new-space" with the default quota using the GraphApi
Scenario: check the COPY response headers Scenario: check the COPY response headers
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"
And user "Alice" has created a folder "new" in space "new-space" And user "Alice" has created a folder "new" in space "new-space"
When user "Alice" copies file "testfile.txt" from space "new-space" to "/new/testfile.txt" inside space "new-space" using the WebDAV API When user "Alice" copies file "testfile.txt" from space "new-space" to "/new/testfile.txt" inside space "new-space" using the WebDAV API
Then the HTTP status code should be "201" Then the HTTP status code should be "201"
And for user "Alice" the COPY response headers for the space "new-space" should contain these key and value pairs: And the following headers should match these regular expressions
| key | value | | Oc-Fileid | /^[a-f0-9!\$\-]{110}$/ |
| Access-Control-Allow-Origin | * | | Access-Control-Allow-Origin | /^[*]{1}$/ |
| Oc-Fileid | UUIDof:/new/testfile.txt |
@@ -3059,38 +3059,4 @@ class SpacesContext implements Context {
) )
); );
} }
/**
* @Then /^for user "([^"]*)" the (?:COPY|MOVE) response headers for the (?:space|mountpoint) "([^"]*)" should contain these key and value pairs:$/
*
* @param string $user
* @param string $space
* @param TableNode $table
*
* @return void
* @throws GuzzleException
* @throws JsonException
*/
public function theCopyResponseHeadersShouldContain(string $user, string $space, TableNode $table): void {
$this->featureContext->verifyTableNodeColumns($table, ['key', 'value']);
$headers = $this->featureContext->getResponse()->getHeaders();
foreach ($table->getHash() as $row) {
$findItem = $row['key'];
$value = str_replace('UUIDof:', '', $row['value']);
foreach ($headers as $headerName => $headerValues) {
if ($headerName === $findItem) {
switch ($findItem) {
case "Oc-Fileid":
Assert::assertEquals($this->getFileId($user, $space, $value), $headerValues[0], 'wrong fileId in the response header');
break;
default:
Assert::assertEquals($value, $headerValues[0], "wrong $findItem in the response header");
break;
}
}
}
}
}
} }