Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2019-12-27 16:51:54 +01:00
Родитель 6b1d560bf9
Коммит 478d24cc75
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4C614C6ED2CDE6DF
2 изменённых файлов: 35 добавлений и 2 удалений

Просмотреть файл

@ -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());
}

Просмотреть файл

@ -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"