diff options
author | Julius Härtl <jus@bitgrid.net> | 2019-12-27 18:51:54 +0300 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2020-01-07 16:49:46 +0300 |
commit | 478d24cc7559e2aa96325d3fcd147976b3c80c8c (patch) | |
tree | 10a74e7710d364bec384f09e05807a4e814ccf51 /tests | |
parent | 6b1d560bf953c5cfc5e8411b9cb560d4a54c2a69 (diff) |
More tests
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/features/bootstrap/FeatureContext.php | 17 | ||||
-rw-r--r-- | tests/features/wopi.feature | 20 |
2 files changed, 35 insertions, 2 deletions
diff --git a/tests/features/bootstrap/FeatureContext.php b/tests/features/bootstrap/FeatureContext.php index 5b49c2fa..e27726b1 100644 --- a/tests/features/bootstrap/FeatureContext.php +++ b/tests/features/bootstrap/FeatureContext.php @@ -4,6 +4,7 @@ require __DIR__ . '/../../vendor/autoload.php'; use Behat\Behat\Context\Context; use GuzzleHttp\Client; use GuzzleHttp\Psr7\Response; +use PHPUnit\Framework\Assert; class FeatureContext implements Context { @@ -103,8 +104,20 @@ class FeatureContext implements Context 'X-LOOL-WOPI-Timestamp' => $this->checkFileInfoResult['LastModifiedTime'] ] ]; - $result = $client->post($this->baseUrl . 'index.php/apps/richdocuments/wopi/files/' . $this->fileId . '/contents?access_token=' . $this->wopiToken, $options); - $this->checkFileInfoResult = json_decode($result->getBody()->getContents(), true); + try { + $result = $client->post($this->baseUrl . 'index.php/apps/richdocuments/wopi/files/' . $this->fileId . '/contents?access_token=' . $this->wopiToken, $options); + $this->checkFileInfoResult = json_decode($result->getBody()->getContents(), true); + } catch (\GuzzleHttp\Exception\ClientException $e) { + $this->response = $e->getResponse(); + } + } + + /** + * @Then /^the HTTP status code should be "([^"]*)"$/ + * @param int $statusCode + */ + public function theHTTPStatusCodeShouldBe($statusCode) { + Assert::assertEquals($statusCode, $this->response->getStatusCode()); } diff --git a/tests/features/wopi.feature b/tests/features/wopi.feature index 2a6ce697..917c8721 100644 --- a/tests/features/wopi.feature +++ b/tests/features/wopi.feature @@ -27,6 +27,26 @@ Scenario: Fetch checkFileInfo for public share link And checkFileInfo "UserId" matches "/Guest-/" And checkFileInfo "OwnerId" is "user1" And checkFileInfo "UserCanWrite" is false + And Collabora puts "./../assets/template.odt" + And the HTTP status code should be "403" + + + Scenario: Fetch checkFileInfo for public share link with write permission + Given as user "user1" + And User "user1" uploads file "./../assets/template.odt" to "/file.odt" + And as "user1" create a share with + | path | /file.odt | + | shareType | 3 | + And Updating last share with + | permissions | 3 | + Then Using web as guest + And a guest opens the share link + And Collabora fetches checkFileInfo + And checkFileInfo "BaseFileName" is "file.odt" + And checkFileInfo "UserId" matches "/Guest-/" + And checkFileInfo "OwnerId" is "user1" + And checkFileInfo "UserCanWrite" is true + And Collabora puts "./../assets/template.odt" Scenario: Save a file as the owner Given as user "user1" |