Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tests-Only] Adds API tests for counting number of etag elements in response of a versioned file #38439

Merged
merged 1 commit into from
Feb 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Talank this checks the version by counting d:getlastmodified so I thought that wouldn't be necessary. Maybe I should rephrase the scenario title.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That works, I suppose.

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