Skip to content

Commit

Permalink
refactor multiple when steps in OCM tests
Browse files Browse the repository at this point in the history
Signed-off-by: prashant-gurung899 <[email protected]>
  • Loading branch information
prashant-gurung899 committed Nov 26, 2024
1 parent 6c3684a commit 4796cdf
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 103 deletions.
2 changes: 1 addition & 1 deletion tests/acceptance/bootstrap/OcmContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public function userListsCreatedInvitations(string $user): void {
}

/**
* @When the user waits :number seconds for the token to expire
* @When the user waits :number seconds for the invitation token to expire
*
* @param int $number
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ The expected failures in this file are from features in the owncloud/ocis repo.

#### [OCM. federated connection is not dropped when one of the users deletes the connection](https://github.com/owncloud/ocis/issues/10216)

- [apiOcm/deleteFederatedConnections.feature:39](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiOcm/deleteFederatedConnections.feature#L39)
- [apiOcm/deleteFederatedConnections.feature:66](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiOcm/deleteFederatedConnections.feature#L66)
- [apiOcm/deleteFederatedConnections.feature:21](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiOcm/deleteFederatedConnections.feature#L21)
- [apiOcm/deleteFederatedConnections.feature:67](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiOcm/deleteFederatedConnections.feature#L67)

#### [OCM. server crash after deleting share for ocm user](https://github.com/owncloud/ocis/issues/10213)

Expand Down
14 changes: 6 additions & 8 deletions tests/acceptance/features/apiOcm/acceptInvitation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,17 @@ Feature: accepting invitation
Scenario: two users can accept one invitation
Given using server "LOCAL"
And "Alice" has created the federation share invitation
When using server "REMOTE"
And "Brian" accepts the last federation share invitation
And using server "REMOTE"
And "Brian" has accepted invitation
When "Carol" accepts the last federation share invitation
Then the HTTP status code should be "200"
And "Carol" accepts the last federation share invitation
And the HTTP status code should be "200"


Scenario: user tries to accept the invitation twice
Given using server "LOCAL"
And "Alice" has created the federation share invitation
When using server "REMOTE"
And "Brian" accepts the last federation share invitation
Then the HTTP status code should be "200"
And using server "REMOTE"
And "Brian" has accepted invitation
When "Brian" tries to accept the last federation share invitation
Then the HTTP status code should be "409"
And the JSON data of the response should match
Expand Down Expand Up @@ -100,7 +98,7 @@ Feature: accepting invitation
And the config "OCM_OCM_INVITE_MANAGER_TOKEN_EXPIRATION" has been set to "1s"
And "Alice" has created the federation share invitation
When using server "REMOTE"
And the user waits "2" seconds for the token to expire
And the user waits "2" seconds for the invitation token to expire
And "Brian" tries to accept the last federation share invitation
Then the HTTP status code should be "400"
And the JSON data of the response should match
Expand Down
109 changes: 31 additions & 78 deletions tests/acceptance/features/apiOcm/createInvitation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -31,33 +31,6 @@ Feature: create invitation
}
}
"""
When "Alice" lists the created invitations
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
{
"type": "array",
"minItems": 1,
"maxItems": 1,
"items": {
"type": "object",
"required": [
"expiration",
"token"
],
"properties": {
"expiration": {
"type": "integer",
"pattern": "^[0-9]{10}$"
},
"token": {
"type": "string",
"pattern": "%fed_invitation_token%"
}
}
}
}
"""

@issue-9591
Scenario: user creates invitation with valid email and description
Expand Down Expand Up @@ -88,37 +61,6 @@ Feature: create invitation
}
}
"""
When "Alice" lists the created invitations
And the HTTP status code should be "200"
And the JSON data of the response should match
"""
{
"type": "array",
"minItems": 1,
"maxItems": 1,
"items": {
"type": "object",
"required": [
"expiration",
"token",
"description"
],
"properties": {
"expiration": {
"type": "integer",
"pattern": "^[0-9]{10}$"
},
"token": {
"type": "string",
"pattern": "%fed_invitation_token%"
},
"description": {
"const": "a share invitation from Alice"
}
}
}
}
"""


Scenario Outline: user creates invitation with valid/invalid email
Expand Down Expand Up @@ -155,36 +97,47 @@ Feature: create invitation
Scenario: user cannot see expired invitation tokens
Given using server "LOCAL"
And the config "OCM_OCM_INVITE_MANAGER_TOKEN_EXPIRATION" has been set to "1s"
When "Alice" creates the federation share invitation
And "Alice" has created the federation share invitation
When the user waits "2" seconds for the invitation token to expire
And "Alice" lists the created invitations
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
{
"type": "object",
"required": [
"expiration",
"token"
],
"properties": {
"expiration": {
"type": "integer",
"pattern": "^[0-9]{10}$"
},
"token": {
"type": "string",
"pattern": "%fed_invitation_token%"
}
}
"type": "array",
"minItems": 0,
"maxItems": 0
}
"""
And the user waits "2" seconds for the token to expire


Scenario: user lists created invitation
Given using server "LOCAL"
And "Alice" has created the federation share invitation
When "Alice" lists the created invitations
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
{
"type": "array",
"minItems": 0,
"maxItems": 0
"minItems": 1,
"maxItems": 1,
"items": {
"type": "object",
"required": [
"expiration",
"token"
],
"properties": {
"expiration": {
"type": "integer",
"pattern": "^[0-9]{10}$"
},
"token": {
"type": "string",
"pattern": "%fed_invitation_token%"
}
}
}
}
"""
"""
27 changes: 13 additions & 14 deletions tests/acceptance/features/apiOcm/deleteFederatedConnections.feature
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,16 @@ Feature: delete federated connections
And "Brian" has accepted invitation
When user "Brian" deletes federated connection with user "Alice" using the Graph API
Then the HTTP status code should be "200"
When user "Brian" searches for federated user "alice" using Graph API

@issue-10216
Scenario: users should not be able to find federated user after federated user has deleted connection
Given using server "LOCAL"
And "Alice" has created the federation share invitation
And using server "REMOTE"
And "Brian" has accepted invitation
And user "Brian" has deleted federated connection with user "Alice"
And using server "LOCAL"
When user "Alice" searches for federated user "Brian" using Graph API
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
Expand All @@ -34,16 +43,8 @@ Feature: delete federated connections
}
}
"""

@issue-10216
Scenario: local user should not be able to find federated user after federated user has deleted connection
Given using server "LOCAL"
And "Alice" has created the federation share invitation
And using server "REMOTE"
And "Brian" has accepted invitation
And user "Brian" has deleted federated connection with user "Alice"
And using server "LOCAL"
When user "Alice" searches for federated user "brian" using Graph API
When user "Brian" searches for federated user "Alice" using Graph API
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
Expand Down Expand Up @@ -77,8 +78,7 @@ Feature: delete federated connections
| shareType | user |
| permissionsRole | Viewer |
And using server "REMOTE"
When user "Brian" deletes federated connection with user "Alice" using the Graph API
Then the HTTP status code should be "200"
And user "Brian" has deleted federated connection with user "Alice"
When user "Brian" lists the shares shared with him without retry using the Graph API
Then the HTTP status code should be "200"
And the JSON data of the response should match
Expand Down Expand Up @@ -112,8 +112,7 @@ Feature: delete federated connections
| sharee | Brian |
| shareType | user |
| permissionsRole | Viewer |
When user "Alice" deletes federated connection with user "Brian" using the Graph API
Then the HTTP status code should be "200"
And user "Alice" has deleted federated connection with user "Brian"
And using server "REMOTE"
When user "Brian" lists the shares shared with him without retry using the Graph API
Then the HTTP status code should be "200"
Expand Down

0 comments on commit 4796cdf

Please sign in to comment.