summaryrefslogtreecommitdiffstats
path: root/tests/integration
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2024-01-26 17:02:23 +0100
committerJoas Schilling <coding@schilljs.com>2024-01-29 12:05:24 +0100
commitb3bdf65e40d44dc6548ade11bc18fa1d6b0186e5 (patch)
tree272f6078e7414b1d4f887a2817f648015ef2794a /tests/integration
parentb26caa8cee82f7f28a71e557645a009d8f680db8 (diff)
fix(federation): Send disinvite on remote user removal and remove invite
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests/integration')
-rw-r--r--tests/integration/features/bootstrap/FeatureContext.php9
-rw-r--r--tests/integration/features/federation/invite.feature47
2 files changed, 54 insertions, 2 deletions
diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php
index 5cb5d7108..5cb001b2c 100644
--- a/tests/integration/features/bootstrap/FeatureContext.php
+++ b/tests/integration/features/bootstrap/FeatureContext.php
@@ -505,7 +505,7 @@ class FeatureContext implements Context, SnippetAcceptingContext {
$invites = $this->getDataFromResponse($this->response);
if ($formData === null) {
- Assert::assertEmpty($invites);
+ Assert::assertEmpty($invites, json_encode($invites, JSON_PRETTY_PRINT));
return;
}
@@ -1370,7 +1370,7 @@ class FeatureContext implements Context, SnippetAcceptingContext {
}
/**
- * @Then /^user "([^"]*)" removes (user|group|email) "([^"]*)" from room "([^"]*)" with (\d+) \((v4)\)$/
+ * @Then /^user "([^"]*)" removes (user|group|email|remote) "([^"]*)" from room "([^"]*)" with (\d+) \((v4)\)$/
*
* @param string $user
* @param string $actorType
@@ -1383,6 +1383,11 @@ class FeatureContext implements Context, SnippetAcceptingContext {
if ($actorId === 'stranger') {
$attendeeId = 123456789;
} else {
+ if ($actorType === 'remote') {
+ $actorId .= '@' . rtrim($this->baseRemoteUrl, '/');
+ $actorType = 'federated_user';
+ }
+
$attendeeId = $this->getAttendeeId($actorType . 's', $actorId, $identifier, $statusCode === 200 ? $user : null);
}
diff --git a/tests/integration/features/federation/invite.feature b/tests/integration/features/federation/invite.feature
index f74a89993..c573b373d 100644
--- a/tests/integration/features/federation/invite.feature
+++ b/tests/integration/features/federation/invite.feature
@@ -62,6 +62,19 @@ Feature: federation/invite
| room | federated_users | participant2@http://localhost:8180 | federated_user_added | {federated_user} accepted the invitation | {"actor":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180"}} |
| room | users | participant1 | federated_user_added | You invited {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180"}} |
| room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} |
+ # Remove a remote user after they joined
+ When user "participant1" removes remote "participant2" from room "room" with 200 (v4)
+ And user "participant2" has the following invitations (v1)
+ Then user "participant2" is participant of the following rooms (v4)
+ When user "participant1" sees the following attendees in room "room" with 200 (v4)
+ | actorType | actorId | participantType |
+ | users | participant1 | 1 |
+ Then user "participant1" sees the following system messages in room "room" with 200
+ | room | actorType | actorId | systemMessage | message | messageParameters |
+ | room | users | participant1 | federated_user_removed | You removed {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180"}} |
+ | room | federated_users | participant2@http://localhost:8180 | federated_user_added | {federated_user} accepted the invitation | {"actor":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180"}} |
+ | room | users | participant1 | federated_user_added | You invited {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180"}} |
+ | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} |
Scenario: Declining an invite
Given the following "spreed" app config is set
@@ -95,6 +108,40 @@ Feature: federation/invite
| room | users | participant1 | federated_user_added | You invited {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180"}} |
| room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} |
+ Scenario: Remove remote user before they accept
+ Given the following "spreed" app config is set
+ | federation_enabled | yes |
+ Given user "participant1" creates room "room" (v4)
+ | roomType | 3 |
+ | roomName | room |
+ And user "participant1" adds remote "participant2" to room "room" with 200 (v4)
+ When user "participant1" sees the following attendees in room "room" with 200 (v4)
+ | actorType | actorId | participantType |
+ | users | participant1 | 1 |
+ | federated_users | participant2 | 3 |
+ Then user "participant1" sees the following system messages in room "room" with 200
+ | room | actorType | actorId | systemMessage | message | messageParameters |
+ | room | users | participant1 | federated_user_added | You invited {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180"}} |
+ | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} |
+ And force run "OCA\Talk\BackgroundJob\RemoveEmptyRooms" background jobs
+ And user "participant2" has the following invitations (v1)
+ | remote_server_url | remote_token | state |
+ | LOCAL | room | 0 |
+ Then user "participant2" has the following notifications
+ | app | object_type | object_id | subject |
+ | spreed | remote_talk_share | INVITE_ID(LOCAL::room) | @participant1-displayname shared room room on http://localhost:8080 with you |
+ When user "participant1" removes remote "participant2" from room "room" with 200 (v4)
+ And user "participant2" has the following invitations (v1)
+ Then user "participant2" is participant of the following rooms (v4)
+ When user "participant1" sees the following attendees in room "room" with 200 (v4)
+ | actorType | actorId | participantType |
+ | users | participant1 | 1 |
+ Then user "participant1" sees the following system messages in room "room" with 200
+ | room | actorType | actorId | systemMessage | message | messageParameters |
+ | room | users | participant1 | federated_user_removed | You removed {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180"}} |
+ | room | users | participant1 | federated_user_added | You invited {federated_user} | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"},"federated_user":{"type":"user","id":"participant2","name":"participant2@localhost:8180","server":"http:\/\/localhost:8180"}} |
+ | room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname"}} |
+
Scenario: Authenticate as a federation user
Given the following "spreed" app config is set
| federation_enabled | yes |