Skip to content

Commit

Permalink
add tests for counting number of etag elements in response of version…
Browse files Browse the repository at this point in the history
…ed file
  • Loading branch information
SwikritiT committed Feb 25, 2021
1 parent 52658c6 commit f6fddca
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 elements 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 elements 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 elements 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 elements was '$number', but got '$actualNumber'"
);
}

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

0 comments on commit f6fddca

Please sign in to comment.