check email validation

This commit is contained in:
Viktor Scharf
2024-09-16 10:32:30 +02:00
parent ac26cd8035
commit 84eb181928
3 changed files with 22 additions and 14 deletions
+4 -2
View File
@@ -70,8 +70,12 @@ class OcmContext implements Context {
/** /**
* @return string * @return string
* @throws Exception
*/ */
public function getLastFederatedInvitationToken():string { public function getLastFederatedInvitationToken():string {
if (empty($this->invitationToken)) {
throw new Exception(__METHOD__ . " token not found");
}
return $this->invitationToken; return $this->invitationToken;
} }
@@ -107,8 +111,6 @@ class OcmContext implements Context {
$responseData = \json_decode($response->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR); $responseData = \json_decode($response->getBody()->getContents(), true, 512, JSON_THROW_ON_ERROR);
if (isset($responseData["token"])) { if (isset($responseData["token"])) {
$this->invitationToken = $responseData["token"]; $this->invitationToken = $responseData["token"];
} else {
throw new Exception(__METHOD__ . " response doesn't contain token");
} }
return $response; return $response;
} }
@@ -259,10 +259,6 @@ The expected failures in this file are from features in the owncloud/ocis repo.
- [apiOcm/share.feature:12](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiOcm/share.feature#L12) - [apiOcm/share.feature:12](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiOcm/share.feature#L12)
- [apiOcm/share.feature:91](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiOcm/share.feature#L91) - [apiOcm/share.feature:91](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiOcm/share.feature#L91)
#### [OCM. user cannot see invite description and inviteUser email](https://github.com/owncloud/ocis/issues/9591)
- [apiOcm/createInvitation.feature:63](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiOcm/createInvitation.feature#L63)
#### [OCM. admin cannot get federated users if he hasn't connection with them ](https://github.com/owncloud/ocis/issues/9829) #### [OCM. admin cannot get federated users if he hasn't connection with them ](https://github.com/owncloud/ocis/issues/9829)
tests/acceptance/features/apiOcm/searchFederationUsers.feature tests/acceptance/features/apiOcm/searchFederationUsers.feature
@@ -60,7 +60,7 @@ Feature: create invitation
""" """
@issue-9591 @issue-9591
Scenario: user creates invitation with email and description Scenario: user creates invitation with valid email and description
Given using server "LOCAL" Given using server "LOCAL"
When "Alice" creates the federation share invitation with email "brian@example.com" and description "a share invitation from Alice" When "Alice" creates the federation share invitation with email "brian@example.com" and description "a share invitation from Alice"
Then the HTTP status code should be "200" Then the HTTP status code should be "200"
@@ -71,8 +71,7 @@ Feature: create invitation
"required": [ "required": [
"expiration", "expiration",
"token", "token",
"description", "description"
"recipient"
], ],
"properties": { "properties": {
"expiration": { "expiration": {
@@ -85,9 +84,6 @@ Feature: create invitation
}, },
"description": { "description": {
"const": "a share invitation from Alice" "const": "a share invitation from Alice"
},
"description": {
"const": "brian@example.com"
} }
} }
} }
@@ -124,6 +120,20 @@ Feature: create invitation
} }
""" """
Scenario Outline: user creates invitation with valid/invalid email
Given using server "LOCAL"
When "Alice" creates the federation share invitation with email "<email>" and description "a share invitation from Alice"
Then the HTTP status code should be "<code>"
Examples:
| email | code |
| user@subdomain.example.longdomain | 200 |
| user.bob+123@domain.test-123.com | 200 |
| user.example.com | 400 |
| user@.com | 400 |
| @domain.com | 400 |
| user@domain..com | 400 |
@email @email
Scenario: federated user gets an email notification if their email was specified when creating the federation share invitation Scenario: federated user gets an email notification if their email was specified when creating the federation share invitation
Given using server "LOCAL" Given using server "LOCAL"
@@ -134,8 +144,8 @@ Feature: create invitation
Alice Hansen (alice@example.org) wants to start sharing collaboration resources with you. Alice Hansen (alice@example.org) wants to start sharing collaboration resources with you.
Please visit your federation provider and use the following details: Please visit your federation provider and use the following details:
Token: %fed_invitation_token% Token: %fed_invitation_token%
ProviderDomain: https://ocis-server:9200 ProviderDomain: https://ocis-server:9200
""" """
@env-config @env-config