Forward port json drill apispaces (#5818)

* Added json schema for response check in apiSpaces suite

Signed-off-by: sagargurung1001@gmail.com <sagargurung1001@gmail.com>

* Review Address

* Added schema for space management feature

* Added new schema asper change in master

* fix feature file

---------

Signed-off-by: sagargurung1001@gmail.com <sagargurung1001@gmail.com>
This commit is contained in:
Sagar Gurung
2023-03-15 10:06:58 +05:45
committed by GitHub
parent 173850a35c
commit 67296caf14
13 changed files with 1673 additions and 245 deletions

View File

@@ -99,7 +99,7 @@ The expected failures in this file are from features in the owncloud/ocis repo.
- [apiSpacesShares/shareSubItemOfSpace.feature:105](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpace.feature#L105)
#### [Space admin should not not be able to change the user quota](https://github.com/owncloud/ocis/issues/5475)
- [apiSpaces/spaceManagement.feature:69](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/spaceManagement.feature#L69)
- [apiSpaces/spaceManagement.feature:149](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/spaceManagement.feature#L149)
#### [Normal user can get expanded members information of a group](https://github.com/owncloud/ocis/issues/5604)
- [apiGraph/getGroup.feature:100](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getGroup.feature#L100)

View File

@@ -24,12 +24,28 @@ Feature: Change data of space
Scenario Outline: Only space admin user can change the name of a Space via the Graph API
When user "<user>" changes the name of the "Project Jupiter" space to "Project Death Star"
When user "<user>" changes the name of the "Project Jupiter" space to "<expectedName>"
Then the HTTP status code should be "<code>"
And the user "<user>" should have a space called "<expectedName>" with these key and value pairs:
| key | value |
| driveType | project |
| name | <expectedName> |
And for user "<user>" the JSON response should contain space called "<expectedName>" and match
"""
{
"type": "object",
"required": [
"name",
"driveType"
],
"properties": {
"name": {
"type": "string",
"enum": ["<expectedName>"]
},
"driveType": {
"type": "string",
"enum": ["project"]
}
}
}
"""
Examples:
| user | code | expectedName |
| Alice | 200 | Project Death Star |
@@ -40,11 +56,31 @@ Feature: Change data of space
Scenario: Only space admin user can change the description(subtitle) of a Space via the Graph API
When user "Alice" changes the description of the "Project Jupiter" space to "The Death Star is a fictional mobile space station"
Then the HTTP status code should be "200"
And the user "Alice" should have a space called "Project Jupiter" with these key and value pairs:
| key | value |
| driveType | project |
| name | Project Jupiter |
| description | The Death Star is a fictional mobile space station |
And for user "Alice" the JSON response should contain space called "Project Jupiter" and match
"""
{
"type": "object",
"required": [
"name",
"driveType",
"description"
],
"properties": {
"driveType": {
"type": "string",
"enum": ["project"]
},
"name": {
"type": "string",
"enum": ["Project Jupiter"]
},
"description": {
"type": "string",
"enum": ["The Death Star is a fictional mobile space station"]
}
}
}
"""
Scenario Outline: Viewer and editor cannot change the description(subtitle) of a Space via the Graph API
@@ -59,10 +95,35 @@ Feature: Change data of space
Scenario Outline: An user tries to increase the quota of a Space via the Graph API
When user "<user>" changes the quota of the "Project Jupiter" space to "100"
Then the HTTP status code should be "<code>"
And the user "<user>" should have a space called "Project Jupiter" with these key and value pairs:
| key | value |
| name | Project Jupiter |
| quota@@@total | <expectedQuataValue> |
And for user "<user>" the JSON response should contain space called "Project Jupiter" and match
"""
{
"type": "object",
"required": [
"name",
"quota"
],
"properties": {
"name": {
"type": "string",
"enum": ["Project Jupiter"]
},
"quota": {
"type": "object",
"required": [
"total"
],
"properties": {
"total" : {
"type": "number",
"enum": [<expectedQuataValue>]
}
}
}
}
}
"""
Examples:
| user | code | expectedQuataValue |
| Alice | 200 | 100 |
@@ -75,11 +136,39 @@ Feature: Change data of space
Then the HTTP status code should be "200"
When user "Alice" uploads a file inside space "Project Jupiter" with content "some content" to "file.txt" using the WebDAV API
Then the HTTP status code should be "201"
And the user "Alice" should have a space called "Project Jupiter" with these key and value pairs:
| key | value |
| name | Project Jupiter |
| quota@@@used | 12 |
| quota@@@total | 0 |
And for user "Alice" the JSON response should contain space called "Project Jupiter" and match
"""
{
"type": "object",
"required": [
"name",
"quota"
],
"properties": {
"name": {
"type": "string",
"enum": ["Project Jupiter"]
},
"quota": {
"type": "object",
"required": [
"used",
"total"
],
"properties": {
"used" : {
"type": "number",
"enum": [12]
},
"total" : {
"type": "number",
"enum": [0]
}
}
}
}
}
"""
Examples:
| quotaValue |
| 0 |
@@ -91,15 +180,78 @@ Feature: Change data of space
And user "Alice" has uploaded a file inside space "Project Jupiter" with content "space description" to ".space/readme.md"
When user "Alice" sets the file ".space/readme.md" as a description in a special section of the "Project Jupiter" space
Then the HTTP status code should be "200"
And the user "Alice" should have a space called "Project Jupiter" owned by "Alice" with description file ".space/readme.md" with these key and value pairs:
| key | value |
| name | Project Jupiter |
| special@@@0@@@size | 17 |
| special@@@0@@@name | readme.md |
| special@@@0@@@specialFolder@@@name | readme |
| special@@@0@@@file@@@mimeType | text/markdown |
| special@@@0@@@id | %file_id% |
| special@@@0@@@eTag | %eTag% |
And for user "Alice" the JSON response should contain space called "Project Jupiter" owned by "Alice" with description file ".space/readme.md" and match
"""
{
"type": "object",
"required": [
"name",
"special"
],
"properties": {
"name": {
"type": "string",
"enum": ["Project Jupiter"]
},
"special": {
"type": "array",
"items": [
{
"type": "object",
"required": [
"size",
"name",
"specialFolder",
"file",
"id",
"eTag"
],
"properties": {
"size": {
"type": "number",
"enum": [17]
},
"name": {
"type": "string",
"enum": ["readme.md"]
},
"specialFolder": {
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string",
"enum": ["readme"]
}
}
},
"file": {
"type": "object",
"required": [
"mimeType"
],
"properties": {
"type": "string",
"enum": ["text/markdown"]
}
},
"id": {
"type": "string",
"enum": ["%file_id%"]
},
"tag": {
"type": "string",
"enum": ["%eTag%"]
}
}
}
]
}
}
}
"""
And for user "Alice" folder ".space/" of the space "Project Jupiter" should contain these entries:
| readme.md |
And for user "Alice" the content of the file ".space/readme.md" of the space "Project Jupiter" should be "space description"
@@ -111,15 +263,78 @@ Feature: Change data of space
And user "Alice" has set the file ".space/readme.md" as a description in a special section of the "Project Jupiter" space
When user "<user>" uploads a file inside space "Project Jupiter" with content "new description" to ".space/readme.md" using the WebDAV API
Then the HTTP status code should be "<code>"
And the user "<user>" should have a space called "Project Jupiter" owned by "Alice" with description file ".space/readme.md" with these key and value pairs:
| key | value |
| name | Project Jupiter |
| special@@@0@@@size | <size> |
| special@@@0@@@name | readme.md |
| special@@@0@@@specialFolder@@@name | readme |
| special@@@0@@@file@@@mimeType | text/markdown |
| special@@@0@@@id | %file_id% |
| special@@@0@@@eTag | %eTag% |
And for user "Alice" the JSON response should contain space called "Project Jupiter" owned by "Alice" with description file ".space/readme.md" and match
"""
{
"type": "object",
"required": [
"name",
"special"
],
"properties": {
"name": {
"type": "string",
"enum": ["Project Jupiter"]
},
"special": {
"type": "array",
"items": [
{
"type": "object",
"required": [
"size",
"name",
"specialFolder",
"file",
"id",
"eTag"
],
"properties": {
"size": {
"type": "number",
"enum": [<size>]
},
"name": {
"type": "string",
"enum": ["readme.md"]
},
"specialFolder": {
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string",
"enum": ["readme"]
}
}
},
"file": {
"type": "object",
"required": [
"mimeType"
],
"properties": {
"type": "string",
"enum": ["text/markdown"]
}
},
"id": {
"type": "string",
"enum": ["%file_id%"]
},
"tag": {
"type": "string",
"enum": ["%eTag%"]
}
}
}
]
}
}
}
"""
And for user "<user>" folder ".space/" of the space "Project Jupiter" should contain these entries:
| readme.md |
And for user "<user>" the content of the file ".space/readme.md" of the space "Project Jupiter" should be "<content>"
@@ -134,15 +349,78 @@ Feature: Change data of space
And user "<user>" has uploaded a file inside space "Project Jupiter" with content "" to ".space/<fileName>"
When user "<user>" sets the file ".space/<fileName>" as a space image in a special section of the "Project Jupiter" space
Then the HTTP status code should be "200"
And the user "Alice" should have a space called "Project Jupiter" owned by "Alice" with description file ".space/<fileName>" with these key and value pairs:
| key | value |
| name | Project Jupiter |
| special@@@0@@@size | 0 |
| special@@@0@@@name | <nameInResponse> |
| special@@@0@@@specialFolder@@@name | image |
| special@@@0@@@file@@@mimeType | <mimeType> |
| special@@@0@@@id | %file_id% |
| special@@@0@@@eTag | %eTag% |
And for user "Alice" the JSON response should contain space called "Project Jupiter" owned by "Alice" with description file ".space/<fileName>" and match
"""
{
"type": "object",
"required": [
"name",
"special"
],
"properties": {
"name": {
"type": "string",
"enum": ["Project Jupiter"]
},
"special": {
"type": "array",
"items": [
{
"type": "object",
"required": [
"size",
"name",
"specialFolder",
"file",
"id",
"eTag"
],
"properties": {
"size": {
"type": "number",
"enum": [0]
},
"name": {
"type": "string",
"enum": ["<nameInResponse>"]
},
"specialFolder": {
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string",
"enum": ["image"]
}
}
},
"file": {
"type": "object",
"required": [
"mimeType"
],
"properties": {
"type": "string",
"enum": ["<mimeType>"]
}
},
"id": {
"type": "string",
"enum": ["%file_id%"]
},
"tag": {
"type": "string",
"enum": ["%eTag%"]
}
}
}
]
}
}
}
"""
And for user "<user>" folder ".space/" of the space "Project Jupiter" should contain these entries:
| <fileName> |
Examples:
@@ -151,7 +429,6 @@ Feature: Change data of space
| Brian | spaceImage.png | spaceImage.png | image/png |
| Alice | spaceImage.gif | spaceImage.gif | image/gif |
Scenario: An user viewer cannot set image file as space image of the space via the Graph API
Given user "Alice" has created a folder ".space" in space "Project Jupiter"
And user "Alice" has uploaded a file inside space "Project Jupiter" with content "" to ".space/someImageFile.jpg"
@@ -166,15 +443,78 @@ Feature: Change data of space
When user "<user>" uploads a file inside space "Project Jupiter" owned by the user "Alice" with content "new content" to ".space/readme.md" using the WebDAV API
Then the HTTP status code should be "<code>"
And for user "<user>" the content of the file ".space/readme.md" of the space "Project Jupiter" should be "<expectedContent>"
And the user "<user>" should have a space called "Project Jupiter" owned by "Alice" with description file ".space/readme.md" with these key and value pairs:
| key | value |
| name | Project Jupiter |
| special@@@0@@@size | <expectedSize> |
| special@@@0@@@name | readme.md |
| special@@@0@@@specialFolder@@@name | readme |
| special@@@0@@@file@@@mimeType | text/markdown |
| special@@@0@@@id | %file_id% |
| special@@@0@@@eTag | %eTag% |
And for user "<user>" the JSON response should contain space called "Project Jupiter" owned by "Alice" with description file ".space/readme.md" and match
"""
{
"type": "object",
"required": [
"name",
"special"
],
"properties": {
"name": {
"type": "string",
"enum": ["Project Jupiter"]
},
"special": {
"type": "array",
"items": [
{
"type": "object",
"required": [
"size",
"name",
"specialFolder",
"file",
"id",
"eTag"
],
"properties": {
"size": {
"type": "number",
"enum": [<expectedSize>]
},
"name": {
"type": "string",
"enum": ["readme.md"]
},
"specialFolder": {
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string",
"enum": ["readme"]
}
}
},
"file": {
"type": "object",
"required": [
"mimeType"
],
"properties": {
"type": "string",
"enum": ["text/markdown"]
}
},
"id": {
"type": "string",
"enum": ["%file_id%"]
},
"tag": {
"type": "string",
"enum": ["%eTag%"]
}
}
}
]
}
}
}
"""
Examples:
| user | code | expectedSize | expectedContent |
| Alice | 204 | 11 | new content |
@@ -189,15 +529,78 @@ Feature: Change data of space
When user "<user>" has uploaded a file inside space "Project Jupiter" with content "" to ".space/newSpaceImage.png"
And user "<user>" sets the file ".space/newSpaceImage.png" as a space image in a special section of the "Project Jupiter" space
Then the HTTP status code should be "200"
And the user "<user>" should have a space called "Project Jupiter" owned by "Alice" with space image ".space/newSpaceImage.png" with these key and value pairs:
| key | value |
| name | Project Jupiter |
| special@@@0@@@size | 0 |
| special@@@0@@@name | newSpaceImage.png |
| special@@@0@@@specialFolder@@@name | image |
| special@@@0@@@file@@@mimeType | image/png |
| special@@@0@@@id | %file_id% |
| special@@@0@@@eTag | %eTag% |
And for user "<user>" the JSON response should contain space called "Project Jupiter" owned by "Alice" with description file ".space/newSpaceImage.png" and match
"""
{
"type": "object",
"required": [
"name",
"special"
],
"properties": {
"name": {
"type": "string",
"enum": ["Project Jupiter"]
},
"special": {
"type": "array",
"items": [
{
"type": "object",
"required": [
"size",
"name",
"specialFolder",
"file",
"id",
"eTag"
],
"properties": {
"size": {
"type": "number",
"enum": [0]
},
"name": {
"type": "string",
"enum": ["newSpaceImage.png"]
},
"specialFolder": {
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string",
"enum": ["image"]
}
}
},
"file": {
"type": "object",
"required": [
"mimeType"
],
"properties": {
"type": "string",
"enum": ["image/png"]
}
},
"id": {
"type": "string",
"enum": ["%file_id%"]
},
"tag": {
"type": "string",
"enum": ["%eTag%"]
}
}
}
]
}
}
}
"""
Examples:
| user |
| Alice |

View File

@@ -26,10 +26,42 @@ Feature: Disabling and deleting space
Scenario Outline: A space admin user can disable a Space via the Graph API
When user "Alice" disables a space "Project Moon"
Then the HTTP status code should be "204"
And the user "Alice" should have a space called "Project Moon" with these key and value pairs:
| key | value |
| name | Project Moon |
| root@@@deleted@@@state | trashed |
And for user "Alice" the JSON response should contain space called "Project Moon" and match
"""
{
"type": "object",
"required": [
"name",
"root"
],
"properties": {
"name": {
"type": "string",
"enum": ["Project Moon"]
},
"root": {
"type": "object",
"required": [
"deleted"
],
"properties": {
"deleted": {
"type": "object",
"required": [
"state"
],
"properties": {
"state": {
"type": "string",
"enum": ["trashed"]
}
}
}
}
}
}
}
"""
And the user "<user>" should not have a space called "Project Moon"
Examples:
| user |
@@ -40,9 +72,21 @@ Feature: Disabling and deleting space
Scenario Outline: An user without space admin role cannot disable a Space via the Graph API
When user "<user>" disables a space "Project Moon"
Then the HTTP status code should be "403"
And the user "<user>" should have a space called "Project Moon" with these key and value pairs:
| key | value |
| name | Project Moon |
And for user "<user>" the JSON response should contain space called "Project Moon" and match
"""
{
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string",
"enum": ["Project Moon"]
}
}
}
"""
Examples:
| user |
| Brian |
@@ -69,6 +113,18 @@ Feature: Disabling and deleting space
Scenario: An space manager cannot delete a space via the webDav API without first disabling it
When user "Alice" deletes a space "Project Moon"
Then the HTTP status code should be "400"
And the user "Alice" should have a space called "Project Moon" with these key and value pairs:
| key | value |
| name | Project Moon |
And for user "Alice" the JSON response should contain space called "Project Moon" and match
"""
{
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string",
"enum": ["Project Moon"]
}
}
}
"""

View File

@@ -14,17 +14,67 @@ Feature: List and create spaces
Scenario: An ordinary user can request information about their Space via the Graph API
When user "Alice" lists all available spaces via the GraphApi
Then the HTTP status code should be "200"
And the json responded should contain a space "Alice Hansen" owned by "Alice" with these key and value pairs:
| key | value |
| driveType | personal |
| driveAlias | personal/alice |
| id | %space_id% |
| name | Alice Hansen |
| owner@@@user@@@id | %user_id% |
| quota@@@state | normal |
| root@@@id | %space_id% |
| root@@@webDavUrl | %base_url%/dav/spaces/%space_id% |
| webUrl | %base_url%/f/%space_id% |
And the JSON response should contain space called "Alice Hansen" and match
"""
{
"type": "object",
"required": [
"driveType",
"driveAlias",
"name",
"id",
"quota",
"root",
"webUrl"
],
"properties": {
"name": {
"type": "string",
"enum": ["Alice Hansen"]
},
"driveType": {
"type": "string",
"enum": ["personal"]
},
"driveAlias": {
"type": "string",
"enum": ["personal/alice"]
},
"id": {
"type": "string",
"enum": ["%space_id%"]
},
"quota": {
"type": "object",
"required": [
"state"
],
"properties": {
"state": {
"type": "string",
"enum": ["normal"]
}
}
},
"root": {
"type": "object",
"required": [
"webDavUrl"
],
"properties": {
"webDavUrl": {
"type": "string",
"enum": ["%base_url%/dav/spaces/%space_id%"]
}
}
},
"webUrl": {
"type": "string",
"enum": ["%base_url%/f/%space_id%"]
}
}
}
"""
Scenario: An ordinary user can request information about their Space via the Graph API using a filter
@@ -32,21 +82,93 @@ Feature: List and create spaces
And user "Brian" has created folder "folder"
And user "Brian" has shared folder "folder" with user "Alice" with permissions "31"
And user "Alice" has accepted share "/folder" offered by user "Brian"
Then the user "Alice" should have a space called "Shares" with these key and value pairs:
| key | value |
| driveType | virtual |
| id | %space_id% |
| name | Shares |
Then for user "Alice" the JSON response should contain space called "Shares" and match
"""
{
"type": "object",
"required": [
"driveType",
"id",
"name"
],
"properties": {
"driveType": {
"type": "string",
"enum": ["virtual"]
},
"id": {
"type": "string",
"enum": ["%space_id%"]
},
"name": {
"type": "string",
"enum": ["Shares"]
}
}
}
"""
When user "Alice" lists all available spaces via the GraphApi with query "$filter=driveType eq 'personal'"
Then the HTTP status code should be "200"
And the json responded should contain a space "Alice Hansen" with these key and value pairs:
| key | value |
| driveType | personal |
| id | %space_id% |
| name | Alice Hansen |
| quota@@@state | normal |
| root@@@webDavUrl | %base_url%/dav/spaces/%space_id% |
| webUrl | %base_url%/f/%space_id% |
And the JSON response should contain space called "Alice Hansen" and match
"""
{
"type": "object",
"required": [
"driveType",
"driveAlias",
"name",
"id",
"quota",
"root"
],
"properties": {
"name": {
"type": "string",
"enum": ["Alice Hansen"]
},
"driveType": {
"type": "string",
"enum": ["personal"]
},
"driveAlias": {
"type": "string",
"enum": ["personal/alice"]
},
"id": {
"type": "string",
"enum": ["%space_id%"]
},
"quota": {
"type": "object",
"required": [
"state"
],
"properties": {
"state": {
"type": "string",
"enum": ["normal"]
}
}
},
"root": {
"type": "object",
"required": [
"webDavUrl"
],
"properties": {
"webDavUrl": {
"type": "string",
"enum": ["%base_url%/dav/spaces/%space_id%"]
}
}
},
"webUrl": {
"type": "string",
"enum": ["%base_url%/f/%space_id%"]
}
}
}
"""
And the json responded should not contain a space with name "Shares"
And the json responded should only contain spaces of type "personal"
@@ -56,11 +178,31 @@ Feature: List and create spaces
And user "Alice" has created a space "my project" of type "project" with quota "20"
When user "Alice" lists all available spaces via the GraphApi with query "$filter=driveType eq 'project'"
Then the HTTP status code should be "200"
And the json responded should contain a space "my project" with these key and value pairs:
| key | value |
| driveType | project |
| id | %space_id% |
| name | my project |
And the JSON response should contain space called "my project" and match
"""
{
"type": "object",
"required": [
"driveType",
"name",
"id"
],
"properties": {
"name": {
"type": "string",
"enum": ["my project"]
},
"driveType": {
"type": "string",
"enum": ["project"]
},
"id": {
"type": "string",
"enum": ["%space_id%"]
}
}
}
"""
And the json responded should not contain a space with name "Alice Hansen"
@@ -85,14 +227,67 @@ Feature: List and create spaces
Given the administrator has given "Alice" the role "<role>" using the settings api
When user "Alice" creates a space "Project Mars" of type "project" with the default quota using the GraphApi
Then the HTTP status code should be "201"
And the json responded should contain a space "Project Mars" with these key and value pairs:
| key | value |
| driveType | project |
| driveAlias | project/project-mars |
| name | Project Mars |
| quota@@@total | 1000000000 |
| root@@@webDavUrl | %base_url%/dav/spaces/%space_id% |
| webUrl | %base_url%/f/%space_id% |
And the JSON response should contain space called "Project Mars" and match
"""
{
"type": "object",
"required": [
"driveType",
"driveAlias",
"name",
"id",
"quota",
"root",
"webUrl"
],
"properties": {
"name": {
"type": "string",
"enum": ["Project Mars"]
},
"driveType": {
"type": "string",
"enum": ["project"]
},
"driveAlias": {
"type": "string",
"enum": ["project/project-mars"]
},
"id": {
"type": "string",
"enum": ["%space_id%"]
},
"quota": {
"type": "object",
"required": [
"total"
],
"properties": {
"state": {
"type": "number",
"enum": [1000000000]
}
}
},
"root": {
"type": "object",
"required": [
"webDavUrl"
],
"properties": {
"webDavUrl": {
"type": "string",
"enum": ["%base_url%/dav/spaces/%space_id%"]
}
}
},
"webUrl": {
"type": "string",
"enum": ["%base_url%/f/%space_id%"]
}
}
}
"""
Examples:
| role |
| Admin |
@@ -103,13 +298,62 @@ Feature: List and create spaces
Given the administrator has given "Alice" the role "<role>" using the settings api
When user "Alice" creates a space "Project Venus" of type "project" with quota "2000" using the GraphApi
Then the HTTP status code should be "201"
And the json responded should contain a space "Project Venus" with these key and value pairs:
| key | value |
| driveType | project |
| name | Project Venus |
| quota@@@total | 2000 |
| root@@@webDavUrl | %base_url%/dav/spaces/%space_id% |
| webUrl | %base_url%/f/%space_id% |
And the JSON response should contain space called "Project Venus" and match
"""
{
"type": "object",
"required": [
"driveType",
"name",
"id",
"quota",
"root",
"webUrl"
],
"properties": {
"name": {
"type": "string",
"enum": ["Project Venus"]
},
"driveType": {
"type": "string",
"enum": ["project"]
},
"id": {
"type": "string",
"enum": ["%space_id%"]
},
"quota": {
"type": "object",
"required": [
"total"
],
"properties": {
"state": {
"type": "number",
"enum": [2000]
}
}
},
"root": {
"type": "object",
"required": [
"webDavUrl"
],
"properties": {
"webDavUrl": {
"type": "string",
"enum": ["%base_url%/dav/spaces/%space_id%"]
}
}
},
"webUrl": {
"type": "string",
"enum": ["%base_url%/f/%space_id%"]
}
}
}
"""
Examples:
| role |
| Admin |
@@ -118,44 +362,228 @@ Feature: List and create spaces
Scenario: A user can list his personal space via multiple endpoints
When user "Alice" lists all available spaces via the GraphApi with query "$filter=driveType eq 'personal'"
Then the json responded should contain a space "Alice Hansen" owned by "Alice" with these key and value pairs:
| key | value |
| driveType | personal |
| name | Alice Hansen |
| root@@@webDavUrl | %base_url%/dav/spaces/%space_id% |
| owner@@@user@@@id | %user_id% |
| webUrl | %base_url%/f/%space_id% |
Then the HTTP status code should be "200"
And the JSON response should contain space called "Alice Hansen" owned by "Alice" and match
"""
{
"type": "object",
"required": [
"driveType",
"name",
"root",
"owner",
"webUrl"
],
"properties": {
"name": {
"type": "string",
"enum": ["Alice Hansen"]
},
"driveType": {
"type": "string",
"enum": ["personal"]
},
"root": {
"type": "object",
"required": [
"webDavUrl"
],
"properties": {
"webDavUrl": {
"type": "string",
"enum": ["%base_url%/dav/spaces/%space_id%"]
}
}
},
"owner": {
"type": "object",
"required": [
"user"
],
"properties": {
"type": "object",
"required": [
"id"
],
"properties": {
"type": "string",
"enum": ["%user_id%"]
}
}
},
"webUrl": {
"type": "string",
"enum": ["%base_url%/f/%space_id%"]
}
}
}
"""
When user "Alice" looks up the single space "Alice Hansen" via the GraphApi by using its id
Then the json responded should contain a space "Alice Hansen" with these key and value pairs:
| key | value |
| driveType | personal |
| name | Alice Hansen |
| root@@@webDavUrl | %base_url%/dav/spaces/%space_id% |
| webUrl | %base_url%/f/%space_id% |
Then the HTTP status code should be "200"
And the JSON response should contain space called "Alice Hansen" and match
"""
{
"type": "object",
"required": [
"driveType",
"name",
"root",
"webUrl"
],
"properties": {
"name": {
"type": "string",
"enum": ["Alice Hansen"]
},
"driveType": {
"type": "string",
"enum": ["personal"]
},
"root": {
"type": "object",
"required": [
"webDavUrl"
],
"properties": {
"webDavUrl": {
"type": "string",
"enum": ["%base_url%/dav/spaces/%space_id%"]
}
}
},
"webUrl": {
"type": "string",
"enum": ["%base_url%/f/%space_id%"]
}
}
}
"""
Scenario Outline: A user can list his created spaces via multiple endpoints
Given the administrator has given "Alice" the role "<role>" using the settings api
When user "Alice" creates a space "Project Venus" of type "project" with quota "2000" using the GraphApi
Then the HTTP status code should be "201"
And the json responded should contain a space "Project Venus" with these key and value pairs:
| key | value |
| driveType | project |
| driveAlias | project/project-venus |
| name | Project Venus |
| quota@@@total | 2000 |
| root@@@webDavUrl | %base_url%/dav/spaces/%space_id% |
| webUrl | %base_url%/f/%space_id% |
And the JSON response should contain space called "Project Venus" and match
"""
{
"type": "object",
"required": [
"driveType",
"driveAlias",
"name",
"id",
"quota",
"root",
"webUrl"
],
"properties": {
"name": {
"type": "string",
"enum": ["Project Venus"]
},
"driveType": {
"type": "string",
"enum": ["project"]
},
"driveAlias": {
"type": "string",
"enum": ["project/project-venus"]
},
"id": {
"type": "string",
"enum": ["%space_id%"]
},
"quota": {
"type": "object",
"required": [
"total"
],
"properties": {
"total": {
"type": "number",
"enum": [2000]
}
}
},
"root": {
"type": "object",
"required": [
"webDavUrl"
],
"properties": {
"webDavUrl": {
"type": "string",
"enum": ["%base_url%/dav/spaces/%space_id%"]
}
}
}
}
}
"""
When user "Alice" looks up the single space "Project Venus" via the GraphApi by using its id
Then the HTTP status code should be "200"
And the json responded should contain a space "Project Venus" with these key and value pairs:
| key | value |
| driveType | project |
| driveAlias | project/project-venus |
| name | Project Venus |
| quota@@@total | 2000 |
| root@@@webDavUrl | %base_url%/dav/spaces/%space_id% |
| webUrl | %base_url%/f/%space_id% |
And the JSON response should contain space called "Project Venus" and match
"""
{
"type": "object",
"required": [
"driveType",
"driveAlias",
"name",
"id",
"quota",
"root",
"webUrl"
],
"properties": {
"name": {
"type": "string",
"enum": ["Project Venus"]
},
"driveType": {
"type": "string",
"enum": ["project"]
},
"driveAlias": {
"type": "string",
"enum": ["project/project-venus"]
},
"id": {
"type": "string",
"enum": ["%space_id%"]
},
"quota": {
"type": "object",
"required": [
"total"
],
"properties": {
"total": {
"type": "number",
"enum": [2000]
}
}
},
"root": {
"type": "object",
"required": [
"webDavUrl"
],
"properties": {
"webDavUrl": {
"type": "string",
"enum": ["%base_url%/dav/spaces/%space_id%"]
}
}
},
"webUrl": {
"type": "string",
"enum": ["%base_url%/f/%space_id%"]
}
}
}
"""
Examples:
| role |
| Admin |

View File

@@ -20,13 +20,49 @@ Feature: State of the quota
Scenario Outline: Quota information is returned in the list of spaces returned via the Graph API
Given user "Alice" has created a space "<spaceName>" of type "project" with quota "<total>"
When user "Alice" uploads a file inside space "<spaceName>" with content "<fileContent>" to "test.txt" using the WebDAV API
Then the user "Alice" should have a space called "<spaceName>" with these key and value pairs:
| key | value |
| name | <spaceName> |
| quota@@@state | <state> |
| quota@@@total | <total> |
| quota@@@remaining| <remaining> |
| quota@@@used | <used> |
Then for user "Alice" the JSON response should contain space called "<spaceName>" and match
"""
{
"type": "object",
"required": [
"name",
"quota"
],
"properties": {
"name": {
"type": "string",
"enum": ["<spaceName>"]
},
"quota": {
"type": "object",
"required": [
"state",
"total",
"remaining",
"used"
],
"properties": {
"state" : {
"type": "string",
"enum": ["<state>"]
},
"total" : {
"type": "number",
"enum": [<total>]
},
"remaining" : {
"type": "number",
"enum": [<remaining>]
},
"used": {
"type": "number",
"enum": [<used>]
}
}
}
}
}
"""
Examples:
| spaceName | fileContent | state | total | remaining | used |
| Quota1% | 1 | normal | 100 | 99 | 1 |

View File

@@ -65,10 +65,34 @@ Feature: Remove files, folder
And for user "<user>" the space "delete objects" <shouldOrNotBeInSpace> contain these entries:
| text.txt |
And as "<user>" file "text.txt" <shouldOrNotBeInTrash> exist in the trashbin of the space "delete objects"
And the user "<user>" should have a space called "delete objects" with these key and value pairs:
| key | value |
| name | delete objects |
| quota@@@used | <quotaValue> |
And for user "<user>" the JSON response should contain space called "delete objects" and match
"""
{
"type": "object",
"required": [
"name",
"quota"
],
"properties": {
"name": {
"type": "string",
"enum": ["delete objects"]
},
"quota": {
"type": "object",
"required": [
"used"
],
"properties": {
"used": {
"type": "number",
"enum": [<quotaValue>]
}
}
}
}
}
"""
Examples:
| user | role | code | shouldOrNotBeInSpace | shouldOrNotBeInTrash | quotaValue |
| Alice | manager | 204 | should not | should | 0 |
@@ -80,6 +104,18 @@ Feature: Remove files, folder
Scenario: An user is unable to delete a Space via the webDav API
When user "Alice" removes the folder "" from space "delete objects"
Then the HTTP status code should be "405"
And the user "Alice" should have a space called "delete objects" with these key and value pairs:
| key | value |
| name | delete objects |
And for user "Alice" the JSON response should contain space called "delete objects" and match
"""
{
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string",
"enum": ["delete objects"]
}
}
}
"""

View File

@@ -82,11 +82,40 @@ Feature: Restore files, folder
When user "Brian" restores version index "1" of file "/file.txt" using the WebDAV API
Then the HTTP status code should be "204"
And the content of file "/file.txt" for user "Brian" should be "file is less than 30 bytes"
And the user "Brian" should have a space called "Brian Murphy" with these key and value pairs:
| key | value |
| quota@@@total | 30 |
| quota@@@used | 38 |
| quota@@@state | exceeded |
And for user "Brian" the JSON response should contain space called "Brian Murphy" and match
"""
{
"type": "object",
"required": [
"quota"
],
"properties": {
"quota": {
"type": "object",
"required": [
"state",
"total",
"remaining",
"used"
],
"properties": {
"state" : {
"type": "string",
"enum": ["exceeded"]
},
"total" : {
"type": "number",
"enum": [30]
},
"used": {
"type": "number",
"enum": [38]
}
}
}
}
}
"""
Scenario: The recipient can restore a file even if there is not enough owner's quota to do so
@@ -100,8 +129,37 @@ Feature: Restore files, folder
When user "Alice" restores version index "1" of file "/Shares/file.txt" using the WebDAV API
Then the HTTP status code should be "204"
And the content of file "/Shares/file.txt" for user "Alice" should be "file is less than 30 bytes"
And the user "Brian" should have a space called "Brian Murphy" with these key and value pairs:
| key | value |
| quota@@@total | 30 |
| quota@@@used | 38 |
| quota@@@state | exceeded |
And for user "Brian" the JSON response should contain space called "Brian Murphy" and match
"""
{
"type": "object",
"required": [
"quota"
],
"properties": {
"quota": {
"type": "object",
"required": [
"state",
"total",
"remaining",
"used"
],
"properties": {
"state" : {
"type": "string",
"enum": ["exceeded"]
},
"total" : {
"type": "number",
"enum": [30]
},
"used": {
"type": "number",
"enum": [38]
}
}
}
}
}
"""

View File

@@ -24,22 +24,62 @@ Feature: Space management
Scenario: The space admin user can see another project space even if he is not member of the space
When user "Brian" lists all spaces via the GraphApi with query "$filter=driveType eq 'project'"
Then the HTTP status code should be "200"
And the json responded should contain a space "Project" with these key and value pairs:
| key | value |
| driveType | project |
| id | %space_id% |
| name | Project |
And the JSON response should contain space called "Project" and match
"""
{
"type": "object",
"required": [
"driveType",
"name",
"id"
],
"properties": {
"name": {
"type": "string",
"enum": ["Project"]
},
"driveType": {
"type": "string",
"enum": ["project"]
},
"id": {
"type": "string",
"enum": ["%space_id%"]
}
}
}
"""
And the json responded should not contain a space with name "Alice Hansen"
Scenario: The space admin user can see another personal spaces
When user "Brian" lists all spaces via the GraphApi with query "$filter=driveType eq 'personal'"
Then the HTTP status code should be "200"
And the json responded should contain a space "Alice Hansen" with these key and value pairs:
| key | value |
| driveType | personal |
| id | %space_id% |
| name | Alice Hansen |
And the JSON response should contain space called "Alice Hansen" and match
"""
{
"type": "object",
"required": [
"driveType",
"name",
"id"
],
"properties": {
"name": {
"type": "string",
"enum": ["Alice Hansen"]
},
"driveType": {
"type": "string",
"enum": ["personal"]
},
"id": {
"type": "string",
"enum": ["%space_id%"]
}
}
}
"""
And the json responded should not contain a space with name "Project"
@@ -53,75 +93,235 @@ Feature: Space management
Scenario: The space admin user changes the quota of the project space
When user "Brian" changes the quota of the "Project" space to "20" owned by user "Alice"
Then the HTTP status code should be "200"
And the user "Alice" should have a space called "Project" with these key and value pairs:
| key | value |
| quota@@@total | 20 |
And for user "Alice" the JSON response should contain space called "Project" and match
"""
{
"type": "object",
"required": [
"quota"
],
"properties": {
"quota": {
"type": "object",
"required": [
"total"
],
"properties": {
"total": {
"type": "number",
"enum": [20]
}
}
}
}
}
"""
Scenario: The user without space admin permissions tries to change the quota of the project space
When user "Carol" tries to change the quota of the "Project" space to "20" owned by user "Alice"
Then the HTTP status code should be "401"
And the user "Alice" should have a space called "Project" with these key and value pairs:
| key | value |
| quota@@@total | 10 |
And for user "Alice" the JSON response should contain space called "Project" and match
"""
{
"type": "object",
"required": [
"quota"
],
"properties": {
"quota": {
"type": "object",
"required": [
"total"
],
"properties": {
"total": {
"type": "number",
"enum": [10]
}
}
}
}
}
"""
Scenario: The space admin user tries to change the quota of the personal space
When user "Brian" tries to change the quota of the "Alice Hansen" space to "20" owned by user "Alice"
Then the HTTP status code should be "401"
And the user "Alice" should have a space called "Alice Hansen" with these key and value pairs:
| key | value |
| quota@@@total | 10 |
And for user "Alice" the JSON response should contain space called "Project" and match
"""
{
"type": "object",
"required": [
"quota"
],
"properties": {
"quota": {
"type": "object",
"required": [
"total"
],
"properties": {
"total": {
"type": "number",
"enum": [10]
}
}
}
}
}
"""
Scenario: The user without space admin permissions tries to change the quota of the personal space
When user "Carol" tries to change the quota of the "Alice Hansen" space to "20" owned by user "Alice"
Then the HTTP status code should be "401"
And the user "Alice" should have a space called "Project" with these key and value pairs:
| key | value |
| quota@@@total | 10 |
And for user "Alice" the JSON response should contain space called "Project" and match
"""
{
"type": "object",
"required": [
"quota"
],
"properties": {
"quota": {
"type": "object",
"required": [
"total"
],
"properties": {
"total": {
"type": "number",
"enum": [10]
}
}
}
}
}
"""
Scenario: The space admin user changes the name of the project space
When user "Brian" changes the name of the "Project" space to "New Name" owned by user "Alice"
Then the HTTP status code should be "200"
And the user "Alice" should have a space called "New Name" with these key and value pairs:
| key | value |
| name | New Name |
And for user "Alice" the JSON response should contain space called "New Name" and match
"""
{
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string",
"enum": ["New Name"]
}
}
}
"""
Scenario: The user without space admin permissions tries to change the name of the project space
When user "Carol" tries to change the name of the "Project" space to "New Name" owned by user "Alice"
Then the HTTP status code should be "403"
And the user "Alice" should have a space called "Project" with these key and value pairs:
| key | value |
| name | Project |
And for user "Alice" the JSON response should contain space called "Project" and match
"""
{
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string",
"enum": ["Project"]
}
}
}
"""
Scenario: The space admin user changes the description of the project space
When user "Brian" changes the description of the "Project" space to "New description" owned by user "Alice"
Then the HTTP status code should be "200"
And the user "Alice" should have a space called "Project" with these key and value pairs:
| key | value |
| description | New description |
And for user "Alice" the JSON response should contain space called "Project" and match
"""
{
"type": "object",
"required": [
"description"
],
"properties": {
"description": {
"type": "string",
"enum": ["New description"]
}
}
}
"""
Scenario: The user without space admin permissions tries to change the description of the project space
Given user "Alice" has changed the description of the "Project" space to "old description"
When user "Carol" tries to change the description of the "Project" space to "New description" owned by user "Alice"
Then the HTTP status code should be "403"
And the user "Alice" should have a space called "Project" with these key and value pairs:
| key | value |
| description | old description |
And for user "Alice" the JSON response should contain space called "Project" and match
"""
{
"type": "object",
"required": [
"description"
],
"properties": {
"description": {
"type": "string",
"enum": ["old description"]
}
}
}
"""
Scenario: The space admin user disables the project space
When user "Brian" disables a space "Project" owned by user "Alice"
Then the HTTP status code should be "204"
And the user "Alice" should have a space called "Project" with these key and value pairs:
| key | value |
| name | Project |
| root@@@deleted@@@state | trashed |
And for user "Alice" the JSON response should contain space called "Project" and match
"""
{
"type": "object",
"required": [
"name",
"root"
],
"properties": {
"name": {
"type": "string",
"enum": ["Project"]
},
"root": {
"type": "object",
"required": [
"deleted"
],
"properties": {
"deleted": {
"type": "object",
"required": [
"state"
],
"properties": {
"state": {
"type": "string",
"enum": ["trashed"]
}
}
}
}
}
}
}
"""
Scenario: The user without space admin permissions tries to disable the project space
@@ -149,10 +349,42 @@ Feature: Space management
Given user "Alice" has disabled a space "Project"
When user "Carol" tries to delete a space "Project" owned by user "Alice"
Then the HTTP status code should be "403"
And the user "Alice" should have a space called "Project" with these key and value pairs:
| key | value |
| name | Project |
| root@@@deleted@@@state | trashed |
And for user "Alice" the JSON response should contain space called "Project" and match
"""
{
"type": "object",
"required": [
"name",
"root"
],
"properties": {
"name": {
"type": "string",
"enum": ["Project"]
},
"root": {
"type": "object",
"required": [
"deleted"
],
"properties": {
"deleted": {
"type": "object",
"required": [
"state"
],
"properties": {
"state": {
"type": "string",
"enum": ["trashed"]
}
}
}
}
}
}
}
"""
Scenario: The space admin user enables the project space
@@ -165,7 +397,39 @@ Feature: Space management
Given user "Alice" has disabled a space "Project"
When user "Carol" tries to restore a disabled space "Project" owned by user "Alice"
Then the HTTP status code should be "404"
And the user "Alice" should have a space called "Project" with these key and value pairs:
| key | value |
| name | Project |
| root@@@deleted@@@state | trashed |
And for user "Alice" the JSON response should contain space called "Project" and match
"""
{
"type": "object",
"required": [
"name",
"root"
],
"properties": {
"name": {
"type": "string",
"enum": ["Project"]
},
"root": {
"type": "object",
"required": [
"deleted"
],
"properties": {
"deleted": {
"type": "object",
"required": [
"state"
],
"properties": {
"state": {
"type": "string",
"enum": ["trashed"]
}
}
}
}
}
}
}
"""

View File

@@ -40,6 +40,34 @@ Feature: Upload files into a space
Then the HTTP status code should be "<code>"
And for user "Brian" the space "Project Ceres" <shouldOrNot> contain these entries:
| test.txt |
And for user "Brian" the JSON response should contain space called "Project Ceres" and match
"""
{
"type": "object",
"required": [
"name",
"quota"
],
"properties": {
"name": {
"type": "string",
"enum": ["Project Ceres"]
},
"quota": {
"type": "object",
"required": [
"used"
],
"properties": {
"used": {
"type": "number",
"enum": [<usedQuota>]
}
}
}
}
}
"""
And the user "Brian" should have a space called "Project Ceres" with these key and value pairs:
| key | value |
| name | Project Ceres |

View File

@@ -1576,15 +1576,16 @@ class FeatureContext extends BehatVariablesContext {
}
/**
* @param PyStringNode $schemaString
* @param PyStringNode|string $schemaString
*
* @return mixed
*/
private function getJSONSchema(PyStringNode $schemaString) {
$schemaRawString = $schemaString->getRaw();
// substitute the inline codes or values
$schemaRawString = $this->substituteInLineCodes($schemaRawString);
$schema = json_decode($schemaRawString);
public function getJSONSchema($schemaString) {
if (\gettype($schemaString) !== 'string') {
$schemaString = $schemaString->getRaw();
}
$schemaString = $this->substituteInLineCodes($schemaString);
$schema = \json_decode($schemaString);
Assert::assertNotNull($schema, 'schema is not valid JSON');
return $schema;
}
@@ -1605,6 +1606,25 @@ class FeatureContext extends BehatVariablesContext {
return null;
}
/**
* @Then the ocs JSON data of the response should match
*
* @param PyStringNode $schemaString
*
* @return void
*
* @throws Exception
*/
public function theOcsDataOfTheResponseShouldMatch(
PyStringNode $schemaString
): void {
$jsonResponse = $this->getJsonDecodedResponseBodyContent();
JsonAssertions::assertJsonDocumentMatchesSchema(
$jsonResponse->ocs->data,
$this->getJSONSchema($schemaString)
);
}
/**
* @Then the JSON data of the response should match
*
@@ -1614,12 +1634,10 @@ class FeatureContext extends BehatVariablesContext {
*
* @throws Exception
*/
public function theDataOfTheResponseShouldMatch(
PyStringNode $schemaString
): void {
$jsonResponse = $this->getJsonDecodedResponseBodyContent();
public function theDataOfTheResponseShouldMatch(PyStringNode $schemaString): void {
$responseBody = $this->getJsonDecodedResponseBodyContent();
JsonAssertions::assertJsonDocumentMatchesSchema(
$jsonResponse->ocs->data,
$responseBody,
$this->getJSONSchema($schemaString)
);
}
@@ -3204,16 +3222,26 @@ class FeatureContext extends BehatVariablesContext {
"parameter" => []
],
[
"code" => "%user_id%",
"function" =>
[$this, "getUserIdByUserName"],
"parameter" => [$userName]
"code" => "%group_id_pattern%",
"function" => [
__NAMESPACE__ . '\TestHelpers\GraphHelper',
"getUUIDv4Regex"
],
"parameter" => []
],
[
"code" => "%group_id%",
"function" =>
[$this, "getGroupIdByGroupName"],
"parameter" => [$group]
"code" => "%user_id%",
"function" => [
$this, "getUserIdByUserName"
],
"parameter" => [$userName]
],
[
"code" => "%group_id%",
"function" => [
$this, "getGroupIdByGroupName"
],
"parameter" => [$group]
]
];
if ($user !== null) {

View File

@@ -24,8 +24,10 @@ declare(strict_types=1);
use Behat\Behat\Context\Context;
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
use Behat\Gherkin\Node\PyStringNode;
use Behat\Gherkin\Node\TableNode;
use GuzzleHttp\Exception\GuzzleException;
use Helmich\JsonAssert\JsonAssertions;
use Psr\Http\Message\ResponseInterface;
use TestHelpers\HttpRequestHelper;
use TestHelpers\WebDavHelper;
@@ -402,7 +404,7 @@ class SpacesContext implements Context {
*/
public function getETag(string $user, string $spaceName, string $fileName): string {
$fileData = $this->getFileData($user, $spaceName, $fileName)->getHeaders();
return $fileData["Etag"][0];
return \str_replace('"', '\"', $fileData["Etag"][0]);
}
/**
@@ -1034,6 +1036,95 @@ class SpacesContext implements Context {
$this->jsonRespondedShouldContain($spaceName, null, null, $grantedGroup, $table);
}
/**
* @Then /^the JSON response should contain space called "([^"]*)" (?:|(?:owned by|granted to) "([^"]*)" )(?:|(?:with description file|with space image) "([^"]*)" )and match$/
*
* @param string $spaceName
* @param string|null $userName
* @param string|null $fileName
* @param PyStringNode $schemaString
*
* @return void
* @throws Exception
*/
public function theJsonDataFromLastResponseShouldMatch(
string $spaceName,
?string $userName = null,
?string $fileName = null,
PyStringNode $schemaString
): void {
if (isset($this->featureContext->getJsonDecodedResponseBodyContent()->value)) {
$responseBody = $this->featureContext->getJsonDecodedResponseBodyContent()->value;
foreach ($responseBody as $value) {
if (isset($value->name) && $value->name === $spaceName) {
$responseBody = $value;
break;
}
}
} else {
$responseBody = $this->featureContext->getJsonDecodedResponseBodyContent();
}
// substitute the value here
$schemaString = $schemaString->getRaw();
$schemaString = $this->featureContext->substituteInLineCodes(
$schemaString,
$this->featureContext->getCurrentUser(),
[],
[
[
"code" => "%space_id%",
"function" =>
[$this, "getSpaceIdByNameFromResponse"],
"parameter" => [$spaceName]
],
[
"code" => "%file_id%",
"function" =>
[$this, "getFileId"],
"parameter" => [$userName, $spaceName, $fileName]
],
[
"code" => "%eTag%",
"function" =>
[$this, "getETag"],
"parameter" => [$userName, $spaceName, $fileName]
],
],
null,
$userName,
);
JsonAssertions::assertJsonDocumentMatchesSchema(
$responseBody,
$this->featureContext->getJSONSchema($schemaString)
);
}
/**
* @Then /^for user "([^"]*)" the JSON response of space project should match$/
* @Then /^for user "([^"]*)" the JSON response should contain space called "([^"]*)" and match$/
* @Then /^for user "([^"]*)" the JSON response should contain space called "([^"]*)" (?:owned by|granted to) "([^"]*)" (?:with description file|with space image) "([^"]*)" and match$/
* @param string $user
* @param string $spaceName
* @param string|null $grantedUser
* @param string|null $fileName
* @param PyStringNode $schemaString
*
* @return void
* @throws Exception|GuzzleException
*/
public function forUserTheJSONDataOfTheResponseShouldMatch(
string $user,
?string $spaceName = null,
?string $grantedUser = null,
?string $fileName = null,
PyStringNode $schemaString
): void {
$this->theUserListsAllHisAvailableSpacesUsingTheGraphApi($user);
$this->theJsonDataFromLastResponseShouldMatch($spaceName, $grantedUser, $fileName, $schemaString);
}
/**
* @Then /^the user "([^"]*)" should have a space called "([^"]*)" granted to "([^"]*)" with role "([^"]*)"$/
*

View File

@@ -56,7 +56,7 @@ Feature: capabilities
When the administrator retrieves the capabilities using the capabilities API
Then the OCS status code should be "100"
And the HTTP status code should be "200"
And the JSON data of the response should match
And the ocs JSON data of the response should match
"""
{
"type": "object",
@@ -95,7 +95,7 @@ Feature: capabilities
When the administrator retrieves the capabilities using the capabilities API
Then the OCS status code should be "100"
And the HTTP status code should be "200"
And the JSON data of the response should match
And the ocs JSON data of the response should match
"""
{
"type": "object",
@@ -134,7 +134,7 @@ Feature: capabilities
When the administrator retrieves the capabilities using the capabilities API
Then the OCS status code should be "100"
And the HTTP status code should be "200"
And the JSON data of the response should match
And the ocs JSON data of the response should match
"""
{
"type": "object",
@@ -173,7 +173,7 @@ Feature: capabilities
When the administrator retrieves the capabilities using the capabilities API
Then the OCS status code should be "100"
And the HTTP status code should be "200"
And the JSON data of the response should match
And the ocs JSON data of the response should match
"""
{
"type": "object",
@@ -212,7 +212,7 @@ Feature: capabilities
@smokeTest
Scenario: getting default capabilities with admin user
When the administrator retrieves the capabilities using the capabilities API
And the JSON data of the response should match
And the ocs JSON data of the response should match
"""
{
"type": "object",

View File

@@ -12,7 +12,7 @@ Feature: default capabilities for normal user
When user "Alice" retrieves the capabilities using the capabilities API
Then the OCS status code should be "100"
And the HTTP status code should be "200"
And the JSON data of the response should match
And the ocs JSON data of the response should match
"""
{
"type": "object",