Skip to content

Commit

Permalink
Refactor existing scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
amrita-shrestha committed Mar 23, 2023
1 parent daf48df commit 88092f8
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 19 deletions.
14 changes: 8 additions & 6 deletions tests/acceptance/features/apiSpaces/createSpace.feature
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
@api
Feature: create space
Only user with admin and SpaceAdmin permissions can create new spaces
As an admin and space admin
I want to create new spaces
So that I can organize a set of resources in a hierarchical tree

Background:
Given user "Alice" has been created with default attributes and without skeleton files


Scenario Outline: The user without permissions to create space cannot create a Space via Graph API
Scenario Outline: user with role user and guest can't create Space via Graph API
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
When user "Alice" tries to create a space "Project Mars" of type "project" with the default quota using the GraphApi
Then the HTTP status code should be "401"
And the user "Alice" should not have a space called "share space"
Examples:
Expand All @@ -17,7 +19,7 @@ Feature: create space
| Guest |


Scenario Outline: An admin or space admin user can create a Space via the Graph API with default quota
Scenario Outline: an admin or space admin user can create a Space via the Graph API with a default quota
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"
Expand Down Expand Up @@ -88,9 +90,9 @@ Feature: create space
| Space Admin |


Scenario Outline: An admin or space admin user can create a Space via the Graph API with certain quota
Scenario Outline: an admin or space admin user can create a Space via the Graph API with certain quota
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
When user "Alice" creates a space "Project Venus" of type "project" with quota "2000" using the Graph API
Then the HTTP status code should be "201"
And the JSON response should contain space called "Project Venus" and match
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Feature: Disabling and deleting space
As a manager of space
I want to be able to disable the space first, then delete it.
I want to make sure that a disabled spaces isn't accessible by shared users.
So that a disabled spaces isn't accessible by shared users.

Note - this feature is run in CI with ACCOUNTS_HASH_DIFFICULTY set to the default for production
See https://github.com/owncloud/ocis/issues/1542 and https://github.com/owncloud/ocis/pull/839
Expand All @@ -24,7 +24,7 @@ Feature: Disabling and deleting space
| role | viewer |


Scenario Outline: user can disable their own Space via the Graph API
Scenario Outline: user can disable their own space via the Graph API
Given the administrator has given "Alice" the role "<role>" using the settings api
When user "Alice" disables a space "Project Moon"
Then the HTTP status code should be "204"
Expand Down Expand Up @@ -74,7 +74,7 @@ Feature: Disabling and deleting space
| Guest |


Scenario Outline: User with role User and Guest cannot disable others Space via the Graph API
Scenario Outline: user with role user and guest cannot disable other space via the Graph API
Given the administrator has given "Carol" the role "<role>" using the settings api
When user "Carol" tries to disable a space "Project Moon" owned by user "Alice"
Then the HTTP status code should be "403"
Expand Down Expand Up @@ -114,7 +114,7 @@ Feature: Disabling and deleting space
| Guest |


Scenario: An space manager can disable and delete Space in which files and folders exist via the webDav API
Scenario: a space manager can disable and delete space in which files and folders exist via the webDav API
Given user "Alice" has uploaded a file inside space "Project Moon" with content "test" to "test.txt"
And user "Alice" has created a folder "MainFolder" in space "Project Moon"
When user "Alice" disables a space "Project Moon"
Expand Down Expand Up @@ -151,7 +151,7 @@ Feature: Disabling and deleting space
| Guest |


Scenario Outline: user can delete their own disabled Space via the Graph API
Scenario Outline: user can delete their own disabled space via the Graph API
Given the administrator has given "Alice" the role "<role>" using the settings api
And user "Alice" has disabled a space "Project Moon"
When user "Alice" deletes a space "Project Moon"
Expand All @@ -165,7 +165,7 @@ Feature: Disabling and deleting space
| Guest |


Scenario Outline: Admin and Space manager can disable others Space via the Graph API
Scenario Outline: an admin and space manager can disable other space via the Graph API
Given the administrator has given "Carol" the role "<role>" using the settings api
When user "Carol" tries to disable a space "Project Moon" owned by user "Alice"
Then the HTTP status code should be "204"
Expand Down Expand Up @@ -211,7 +211,7 @@ Feature: Disabling and deleting space
| Space Admin |


Scenario Outline: Admin and Space manager can delete others disabled Space
Scenario Outline: an admin and space manager can delete other disabled Space
Given the administrator has given "Carol" the role "<role>" using the settings api
And user "Alice" has disabled a space "Project Moon"
When user "Carol" tries to delete a space "Project Moon" owned by user "Alice"
Expand All @@ -223,7 +223,7 @@ Feature: Disabling and deleting space
| Space Admin |


Scenario Outline: User with role User and Guest cannot delete others disabled Space via the Graph API
Scenario Outline: user with role user and guest cannot delete others disabled Space via the Graph API
Given the administrator has given "Carol" the role "<role>" using the settings api
And user "Alice" has disabled a space "Project Moon"
When user "Carol" tries to delete a space "Project Moon" owned by user "Alice"
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/features/apiSpaces/listSpaces.feature
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ Feature: List and create spaces

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
When user "Alice" creates a space "Project Venus" of type "project" with quota "2000" using the Graph API
Then the HTTP status code should be "201"
And the JSON response should contain space called "Project Venus" and match
"""
Expand Down
6 changes: 3 additions & 3 deletions tests/acceptance/features/apiSpaces/restoreSpaces.feature
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Feature: Restoring space
| mainFolder |


Scenario: Participant can create data in the space after restoring
Scenario: participant can create data in the space after restoring
Given user "Alice" has shared a space "restore a space" with settings:
| shareWith | Brian |
| role | editor |
Expand All @@ -73,7 +73,7 @@ Feature: Restoring space
| editor |


Scenario Outline: User with role User and Guest cannot restore space
Scenario Outline: user with role User and Guest cannot restore space
Given the administrator has given "Brian" the role "<role>" using the settings api
And user "Alice" has disabled a space "restore a space"
When user "Brian" tries to restore a disabled space "restore a space" owned by user "Alice"
Expand All @@ -84,7 +84,7 @@ Feature: Restoring space
| Guest |

@issue-5872
Scenario Outline: Admin and Space Admin can restore others space
Scenario Outline: an admin and space Admin can restore other space
Given the administrator has given "Brian" the role "<role>" using the settings api
And user "Alice" has disabled a space "restore a space"
When user "Brian" tries to restore a disabled space "restore a space" owned by user "Alice"
Expand Down
3 changes: 2 additions & 1 deletion tests/acceptance/features/bootstrap/SpacesContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,8 @@ public function theUserCreatesASpaceUsingTheGraphApi(
}

/**
* @When /^user "([^"]*)" creates a space "([^"]*)" of type "([^"]*)" with quota "([^"]*)" using the GraphApi$/
* @When /^user "([^"]*)" creates a space "([^"]*)" of type "([^"]*)" with quota "([^"]*)" using the Graph API$/
* @When /^user "([^"]*)" (?:creates|tries to create) a space "([^"]*)" of type "([^"]*)" with quota "([^"]*)" using the Graph API$/
*
* @param string $user
* @param string $spaceName
Expand Down

0 comments on commit 88092f8

Please sign in to comment.