-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9597 from owncloud/listInvitationTest
[test-only] list Invitation
- Loading branch information
Showing
8 changed files
with
316 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,57 +14,15 @@ Feature: accepting invitation | |
|
||
Scenario: user accepts invitation | ||
Given using server "LOCAL" | ||
When "Alice" creates the federation share invitation | ||
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_pattern%$" | ||
} | ||
} | ||
} | ||
""" | ||
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" | ||
|
||
|
||
Scenario: user accepts invitation sent with email and description | ||
Given using server "LOCAL" | ||
When "Alice" creates the federation share invitation with email "[email protected]" and description "a share invitation from Alice" | ||
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_pattern%$" | ||
} | ||
} | ||
} | ||
""" | ||
And "Alice" has created the federation share invitation with email "[email protected]" and description "a share invitation from Alice" | ||
When using server "REMOTE" | ||
And "Brian" accepts the last federation share invitation | ||
Then the HTTP status code should be "200" | ||
|
@@ -135,3 +93,56 @@ Feature: accepting invitation | |
} | ||
} | ||
""" | ||
|
||
@env-config | ||
Scenario: user cannot accept expired invitation tokens | ||
Given using server "LOCAL" | ||
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 "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 | ||
""" | ||
{ | ||
"type": "object", | ||
"required": [ | ||
"code", | ||
"message" | ||
], | ||
"properties": { | ||
"code": { | ||
"const": "INVALID_PARAMETER" | ||
}, | ||
"message": { | ||
"const": "token has expired" | ||
} | ||
} | ||
} | ||
""" | ||
|
||
|
||
Scenario: user cannot accept invalid invitation token | ||
Given using server "LOCAL" | ||
And "Alice" tries to accept the invitation with invalid token | ||
Then the HTTP status code should be "404" | ||
And the JSON data of the response should match | ||
""" | ||
{ | ||
"type": "object", | ||
"required": [ | ||
"code", | ||
"message" | ||
], | ||
"properties": { | ||
"code": { | ||
"const": "RESOURCE_NOT_FOUND" | ||
}, | ||
"message": { | ||
"const": "token not found" | ||
} | ||
} | ||
} | ||
""" | ||
|
168 changes: 168 additions & 0 deletions
168
tests/acceptance/features/apiOcm/createInvitation.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
@ocm | ||
Feature: create invitation | ||
As a user | ||
I can create an invitations and send it to the person I want to share with | ||
|
||
Background: | ||
Given user "Alice" has been created with default attributes and without skeleton files | ||
|
||
|
||
Scenario: user creates invitation | ||
Given using server "LOCAL" | ||
When "Alice" creates the federation share invitation | ||
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_pattern%$" | ||
} | ||
} | ||
} | ||
""" | ||
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_pattern%$" | ||
} | ||
} | ||
} | ||
} | ||
""" | ||
|
||
@issue-9591 | ||
Scenario: user creates invitation with email and description | ||
Given using server "LOCAL" | ||
When "Alice" creates the federation share invitation with email "[email protected]" and description "a share invitation from Alice" | ||
Then the HTTP status code should be "200" | ||
And the JSON data of the response should match | ||
""" | ||
{ | ||
"type": "object", | ||
"required": [ | ||
"expiration", | ||
"token", | ||
"description", | ||
"recipient" | ||
], | ||
"properties": { | ||
"expiration": { | ||
"type": "integer", | ||
"pattern": "^[0-9]{10}$" | ||
}, | ||
"token": { | ||
"type": "string", | ||
"pattern": "^%fed_invitation_token_pattern%$" | ||
}, | ||
"description": { | ||
"type": "string", | ||
"const": "a share invitation from Alice" | ||
}, | ||
"recipient": { | ||
"type": "string", | ||
"const": "[email protected]" | ||
} | ||
} | ||
} | ||
""" | ||
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" | ||
], | ||
"properties": { | ||
"expiration": { | ||
"type": "integer", | ||
"pattern": "^[0-9]{10}$" | ||
}, | ||
"token": { | ||
"type": "string", | ||
"pattern": "^%fed_invitation_token_pattern%$" | ||
}, | ||
"description": { | ||
"type": "string", | ||
"const": "a share invitation from Alice" | ||
}, | ||
"recipient": { | ||
"type": "string", | ||
"const": "[email protected]" | ||
} | ||
} | ||
} | ||
} | ||
""" | ||
|
||
@env-config | ||
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 | ||
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_pattern%$" | ||
} | ||
} | ||
} | ||
""" | ||
And the user waits "2" seconds for the token to expire | ||
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 | ||
} | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.