Skip to content

Commit

Permalink
add tests for counting number of etag element in response of versione…
Browse files Browse the repository at this point in the history
…d file
  • Loading branch information
SwikritiT committed Feb 24, 2021
1 parent e26b71e commit 2ccc95d
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/acceptance/features/apiVersions/fileVersions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -420,3 +420,13 @@ Feature: dav-versions
Given user "Alice" has uploaded file with content "uploaded content" to "textfile0.txt"
When user "Alice" gets the number of versions of file "textfile0.txt"
Then the number of versions should be "0"

@issue-ocis-1234
Scenario: the number of etag element in response changes according to version of the file
Given user "Alice" has uploaded file with content "uploaded content" to "textfile0.txt"
And user "Alice" has uploaded file with content "version 1" to "textfile0.txt"
And user "Alice" has uploaded file with content "version 2" to "textfile0.txt"
When user "Alice" gets the number of versions of file "textfile0.txt"
Then the HTTP status code should be "207"
And the number of etag element in the response should be "2"
And the number of versions should be "2"
25 changes: 25 additions & 0 deletions tests/acceptance/features/bootstrap/WebDav.php
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,31 @@ public function theNumberOfVersionsShouldBe($number) {
);
}

/**
* @Then the number of etag element in the response should be :number
*
* @param int $number
*
* @return void
* @throws Exception
*/
public function theNumberOfEtagElementInTheResponseShouldBe($number) {
$resXml = $this->getResponseXmlObject();
if ($resXml === null) {
$resXml = HttpRequestHelper::getResponseXml(
$this->getResponse(),
__METHOD__
);
}
$xmlPart = $resXml->xpath("//d:getetag");
$actualNumber = \count($xmlPart);
Assert::assertEquals(
$number,
$actualNumber,
"Expected number of etag element was '$number', but got '$actualNumber'"
);
}

/**
* @Given /^the administrator has (enabled|disabled) async operations$/
*
Expand Down

0 comments on commit 2ccc95d

Please sign in to comment.