diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2021-04-08 21:00:11 +0200 |
---|---|---|
committer | Vincent Petry <vincent@nextcloud.com> | 2021-11-05 09:48:52 +0100 |
commit | 9497a7c4ff77cf44d8b1fb875070d60b6404c449 (patch) | |
tree | febee97ea88e1a41d3a9593160bce144aafe236a /build/integration/features | |
parent | 66b5a2d56afd1d84117b99e468ec7788c44d21b1 (diff) | |
download | nextcloud-server-9497a7c4ff77cf44d8b1fb875070d60b6404c449.tar.gz nextcloud-server-9497a7c4ff77cf44d8b1fb875070d60b6404c449.zip |
Add integration tests for listing federated shares
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'build/integration/features')
-rw-r--r-- | build/integration/features/bootstrap/FederationContext.php | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/build/integration/features/bootstrap/FederationContext.php b/build/integration/features/bootstrap/FederationContext.php index d859afc610f..a4472c54b1b 100644 --- a/build/integration/features/bootstrap/FederationContext.php +++ b/build/integration/features/bootstrap/FederationContext.php @@ -28,6 +28,7 @@ */ use Behat\Behat\Context\Context; use Behat\Behat\Context\SnippetAcceptingContext; +use Behat\Gherkin\Node\TableNode; require __DIR__ . '/../../vendor/autoload.php'; @@ -97,6 +98,37 @@ class FederationContext implements Context, SnippetAcceptingContext { } /** + * @Then remote share :count is returned with + * + * @param int $number + * @param TableNode $body + */ + public function remoteShareXIsReturnedWith(int $number, TableNode $body) { + $this->theHTTPStatusCodeShouldBe('200'); + $this->theOCSStatusCodeShouldBe('100'); + + if (!($body instanceof TableNode)) { + return; + } + + $returnedShare = $this->getXmlResponse()->data[0]; + if ($returnedShare->element) { + $returnedShare = $returnedShare->element[$number]; + } + + $defaultExpectedFields = [ + 'id' => 'A_NUMBER', + 'remote_id' => 'A_NUMBER', + 'accepted' => '1', + ]; + $expectedFields = array_merge($defaultExpectedFields, $body->getRowsHash()); + + foreach ($expectedFields as $field => $value) { + $this->assertFieldIsInReturnedShare($field, $value, $returnedShare); + } + } + + /** * @When /^User "([^"]*)" from server "(LOCAL|REMOTE)" accepts last pending share$/ * @param string $user * @param string $server |