fix after review

This commit is contained in:
Viktor Scharf
2024-09-12 10:08:43 +02:00
parent 283948487b
commit 438e445a1c
5 changed files with 50 additions and 16 deletions

View File

@@ -148,13 +148,23 @@ config = {
],
"skip": False,
"federationServer": True,
"emailNeeded": True,
"extraEnvironment": {
"EMAIL_HOST": "email",
"EMAIL_PORT": "9000",
},
"extraServerEnvironment": {
"OCIS_ADD_RUN_SERVICES": "ocm",
"OCIS_ADD_RUN_SERVICES": "ocm,notifications",
"OCIS_ENABLE_OCM": True,
"OCM_OCM_INVITE_MANAGER_INSECURE": True,
"OCM_OCM_SHARE_PROVIDER_INSECURE": True,
"OCM_OCM_STORAGE_PROVIDER_INSECURE": True,
"OCM_OCM_PROVIDER_AUTHORIZER_PROVIDERS_FILE": "%s" % dirs["ocmProviders"],
# mail notifications
"NOTIFICATIONS_SMTP_HOST": "email",
"NOTIFICATIONS_SMTP_PORT": "2500",
"NOTIFICATIONS_SMTP_INSECURE": "true",
"NOTIFICATIONS_SMTP_SENDER": "ownCloud <noreply@example.com>",
},
},
"apiWopi": {

View File

@@ -58,7 +58,7 @@ class OcmHelper {
?string $email = null,
?string $description = null
): ResponseInterface {
$body['params'] = [
$body = [
"description" => $description,
"recipient" => $email
];

View File

@@ -162,6 +162,7 @@ class FeatureContext extends BehatVariablesContext {
public TUSContext $tusContext;
public GraphContext $graphContext;
public SpacesContext $spacesContext;
public OcmContext $ocmContext;
/**
* The codes are stored as strings, even though they are numbers
@@ -2318,10 +2319,10 @@ class FeatureContext extends BehatVariablesContext {
"parameter" => []
],
[
"code" => "%fed_invitation_token_pattern%",
"code" => "%fed_invitation_token%",
"function" => [
__NAMESPACE__ . '\TestHelpers\GraphHelper',
"getUUIDv4Regex"
$this->ocmContext,
"getLastFederatedInvitationToken"
],
"parameter" => []
],
@@ -2530,12 +2531,14 @@ class FeatureContext extends BehatVariablesContext {
$this->ocsContext = new OCSContext();
$this->authContext = new AuthContext();
$this->tusContext = new TUSContext();
$this->ocmContext = new OcmContext();
$this->ocsContext->before($scope);
$this->authContext->setUpScenario($scope);
$this->tusContext->setUpScenario($scope);
$environment->registerContext($this->ocsContext);
$environment->registerContext($this->authContext);
$environment->registerContext($this->tusContext);
$environment->registerContext($this->ocmContext);
$scenarioLine = $scope->getScenario()->getLine();
$featureFile = $scope->getFeature()->getFile();
$suiteName = $scope->getSuite()->getName();

View File

@@ -68,6 +68,13 @@ class OcmContext implements Context {
return $this->extractDomain(\getenv('TEST_SERVER_FED_URL'));
}
/**
* @return string
*/
public function getLastFederatedInvitationToken():string {
return $this->invitationToken;
}
/**
* @param string $url
*
@@ -151,7 +158,7 @@ class OcmContext implements Context {
$this->featureContext->getStepLineRef(),
$user,
$this->featureContext->getPasswordForUser($user),
$token ? $token : $this->invitationToken,
$token ? $token : $this->getLastFederatedInvitationToken(),
$providerDomain
);
}

View File

@@ -26,7 +26,7 @@ Feature: create invitation
},
"token": {
"type": "string",
"pattern": "^%fed_invitation_token_pattern%$"
"pattern": "%fed_invitation_token%"
}
}
}
@@ -52,7 +52,7 @@ Feature: create invitation
},
"token": {
"type": "string",
"pattern": "^%fed_invitation_token_pattern%$"
"pattern": "%fed_invitation_token%"
}
}
}
@@ -81,17 +81,18 @@ Feature: create invitation
},
"token": {
"type": "string",
"pattern": "^%fed_invitation_token_pattern%$"
"pattern": "%fed_invitation_token%"
},
"description": {
"const": "a share invitation from Alice"
},
"recipient": {
"description": {
"const": "brian@example.com"
}
}
}
"""
When "Alice" lists the created invitations
And the HTTP status code should be "200"
And the JSON data of the response should match
"""
@@ -103,7 +104,8 @@ Feature: create invitation
"type": "object",
"required": [
"expiration",
"token"
"token",
"description"
],
"properties": {
"expiration": {
@@ -112,19 +114,31 @@ Feature: create invitation
},
"token": {
"type": "string",
"pattern": "^%fed_invitation_token_pattern%$"
"pattern": "%fed_invitation_token%"
},
"description": {
"const": "a share invitation from Alice"
},
"recipient": {
"const": "brian@example.com"
}
}
}
}
"""
@email
Scenario: federated user gets an email notification if their email was specified when creating the federation share invitation
Given using server "LOCAL"
When "Alice" has created the federation share invitation with email "brian@example.com" and description "a share invitation from Alice"
And user "Brian" should have received the following email from user "Alice"
"""
Hi,
Alice Hansen (alice@example.org) wants to start sharing collaboration resources with you.
Please visit your federation provider and use the following details:
Token: %fed_invitation_token%
ProviderDomain: https://ocis-server:9200
"""
@env-config
Scenario: user cannot see expired invitation tokens
Given using server "LOCAL"
@@ -146,7 +160,7 @@ Feature: create invitation
},
"token": {
"type": "string",
"pattern": "^%fed_invitation_token_pattern%$"
"pattern": "%fed_invitation_token%"
}
}
}