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