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 27, 2023
1 parent fa4df84 commit e57d62d
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,5 +142,9 @@ The expected failures in this file are from features in the owncloud/ocis repo.
#### [Admin user can't restore other user spaces](https://github.com/owncloud/ocis/issues/5872)
- [apiSpaces/restoreSpaces.feature:94](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/restoreSpaces.feature#L94)

#### [https://github.com/owncloud/ocis/issues/5938](https://github.com/owncloud/ocis/issues/5938)
- [apiSpaces/createSpace.feature:18](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/createSpace.feature#L18)
- [apiSpaces/createSpace.feature:19](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/createSpace.feature#L19)

Note: always have an empty line at the end of this file.
The bash script that processes this file requires that the last line has a newline on the end.
18 changes: 10 additions & 8 deletions tests/acceptance/features/apiSpaces/createSpace.feature
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
@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
Then the HTTP status code should be "401"
When user "Alice" tries to create a space "Project Mars" of type "project" with the default quota using the Graph API
Then the HTTP status code should be "403"
And the user "Alice" should not have a space called "share space"
Examples:
| role |
| User |
| 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
When user "Alice" creates a space "Project Mars" of type "project" with the default quota using the Graph API
Then the HTTP status code should be "201"
And the JSON response should contain space called "Project Mars" and match
"""
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
10 changes: 5 additions & 5 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 @@ -60,7 +60,7 @@ Feature: Restoring space
| mainFolder |


Scenario Outline: User without space manager role cannot restore space
Scenario Outline: user without space manager role cannot restore space
Given user "Alice" has shared a space "restore a space" with settings:
| shareWith | Brian |
| role | <role> |
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,10 +84,10 @@ Feature: Restoring space
| Guest |

@issue-5872
Scenario Outline: Admin and Space Admin can restore others space
Scenario Outline: 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"
When user "Brian" restores a disabled space "restore a space" owned by user "Alice"
Then the HTTP status code should be "200"
Examples:
| role |
Expand Down
4 changes: 2 additions & 2 deletions tests/acceptance/features/bootstrap/SpacesContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ public function theUserLooksUpTheSingleSpaceUsingTheGraphApiByUsingItsId(string
}

/**
* @When /^user "([^"]*)" creates a space "([^"]*)" of type "([^"]*)" with the default quota using the GraphApi$/
* @When /^user "([^"]*)" (?:creates|tries to create) a space "([^"]*)" of type "([^"]*)" with the default quota using the Graph API$/
*
* @param string $user
* @param string $spaceName
Expand Down Expand Up @@ -658,7 +658,7 @@ 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$/
*
* @param string $user
* @param string $spaceName
Expand Down

0 comments on commit e57d62d

Please sign in to comment.