Merge pull request #9885 from owncloud/test-app-endpoint

[tests-only][full-ci]add test coverage for `/app/open` endpoint
This commit is contained in:
Prajwol Amatya
2024-08-27 11:22:12 +05:45
committed by GitHub
6 changed files with 171 additions and 61 deletions
+7
View File
@@ -400,6 +400,13 @@ default:
- SharingNgContext:
- GraphContext:
apiCollaboration:
paths:
- "%paths.base%/../features/apiCollaboration"
context: *common_ldap_suite_context
contexts:
- FeatureContext: *common_feature_context_params
cliCommands:
paths:
- "%paths.base%/../features/cliCommands"
@@ -0,0 +1,51 @@
Feature: collaboration (wopi)
As a user
I want to access files with collaboration service apps
So that I can collaborate with other users
Scenario Outline: open file with .odt extension
Given user "Alice" has been created with default attributes and without skeleton files
And user "Alice" has uploaded file "filesForUpload/simple.odt" to "simple.odt"
And we save it into "FILEID"
When user "Alice" sends HTTP method "POST" to URL "<app-endpoint>"
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
{
"type": "object",
"required": [
"app_url",
"method",
"form_parameters"
],
"properties": {
"app_url": {
"type": "string",
"pattern": "^.*\\?WOPISrc=.*wopi%2Ffiles%2F[a-fA-F0-9]{64}$"
},
"method": {
"const": "POST"
},
"form_parameters": {
"type": "object",
"required": [
"access_token",
"access_token_ttl"
],
"properties": {
"access_token": {
"type": "string"
},
"access_token_ttl": {
"type": "string"
}
}
}
}
}
"""
Examples:
| app-endpoint |
| /app/open?file_id=<<FILEID>>&app_name=FakeOffice |
| /app/open?file_id=<<FILEID>> |
@@ -1743,15 +1743,16 @@ trait WebDav {
* @param string $source
* @param string $destination
*
* @return void
* @return array
*/
public function userHasUploadedAFileTo(string $user, string $source, string $destination):void {
public function userHasUploadedAFileTo(string $user, string $source, string $destination):array {
$response = $this->uploadFile($user, $source, $destination, true);
$this->theHTTPStatusCodeShouldBe(
["201", "204"],
"HTTP status code was not 201 or 204 while trying to upload file '$source' to '$destination' for user '$user'",
$response
);
return $response->getHeader('oc-fileid');
}
/**
+9
View File
@@ -0,0 +1,9 @@
app_registry:
mimetypes:
- mime_type: application/vnd.oasis.opendocument.text
extension: odt
name: OpenDocument
description: OpenDocument text document
icon: ""
default_app: FakeOffice
allow_creation: true
+11 -7
View File
@@ -1,8 +1,12 @@
<wopi-discovery>
<net-zone name="external-http">
<app favIconUrl="https://fakeoffice.owncloud.test/favicon.ico" name="wopitest">
<action default="true" ext="wopitest" name="view" urlsrc="https://fakeoffice.owncloud.test/not/relevant?"/>
<action default="true" ext="wopitest" name="edit" urlsrc="https://fakeoffice.owncloud.test/not/relevant?"/>
</app>
</net-zone>
</wopi-discovery>
<net-zone name="external-http">
<app favIconUrl="https://fakeoffice.owncloud.test/favicon.ico" name="wopitest">
<action default="true" ext="wopitest" name="view" urlsrc="https://fakeoffice.owncloud.test/not/relevant?"/>
<action default="true" ext="wopitest" name="edit" urlsrc="https://fakeoffice.owncloud.test/not/relevant?"/>
<action default="true" ext="odt" name="view" urlsrc="https://fakeoffice.owncloud.test/not/relevant?"/>
<action default="true" ext="odt" name="edit" urlsrc="https://fakeoffice.owncloud.test/not/relevant?"/>
<action default="true" ext="txt" name="view" urlsrc="https://fakeoffice.owncloud.test/not/relevant?"/>
<action default="true" ext="txt" name="edit" urlsrc="https://fakeoffice.owncloud.test/not/relevant?"/>
</app>
</net-zone>
</wopi-discovery>