summaryrefslogtreecommitdiffstats
path: root/tests/integration
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2024-02-12 17:23:53 +0100
committerJoas Schilling <coding@schilljs.com>2024-02-14 08:04:48 +0100
commit2bfa2987f6b22f7f8eeada60b62dc0dfb25b2b3d (patch)
treeca0a104857272a5d8aeb3b21c1c13ca95c919bc8 /tests/integration
parent020add24618487c8a7b73fa4c04ed18ae37dee4e (diff)
feat(federation): Add inviter information to the invitations DB for serving
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests/integration')
-rw-r--r--tests/integration/features/bootstrap/FeatureContext.php21
-rw-r--r--tests/integration/features/federation/invite.feature28
2 files changed, 31 insertions, 18 deletions
diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php
index b0dcd23ab..6b6d5bcb0 100644
--- a/tests/integration/features/bootstrap/FeatureContext.php
+++ b/tests/integration/features/bootstrap/FeatureContext.php
@@ -555,13 +555,26 @@ class FeatureContext implements Context, SnippetAcceptingContext {
*/
private function assertInvites($invites, TableNode $formData) {
Assert::assertCount(count($formData->getHash()), $invites, 'Invite count does not match');
- Assert::assertEquals($formData->getHash(), array_map(function ($invite, $expectedInvite) {
+ $expectedInvites = array_map(static function ($expectedInvite): array {
+ if (isset($expectedInvite['state'])) {
+ $expectedInvite['state'] = (int) $expectedInvite['state'];
+ }
+ return $expectedInvite;
+ }, $formData->getHash());
+
+ Assert::assertEquals($expectedInvites, array_map(function ($invite, $expectedInvite): array {
$data = [];
if (isset($expectedInvite['id'])) {
$data['id'] = self::$tokenToIdentifier[$invite['token']];
}
if (isset($expectedInvite['accessToken'])) {
- $data['accessToken'] = (string) $invite['accessToken'];
+ $data['accessToken'] = $invite['accessToken'];
+ }
+ if (isset($expectedInvite['inviterCloudId'])) {
+ $data['inviterCloudId'] = $invite['inviterCloudId'];
+ }
+ if (isset($expectedInvite['inviterDisplayName'])) {
+ $data['inviterDisplayName'] = $invite['inviterDisplayName'];
}
if (isset($expectedInvite['remoteToken'])) {
$data['remoteToken'] = self::$tokenToIdentifier[$invite['remoteToken']] ?? 'unknown-token';
@@ -570,11 +583,11 @@ class FeatureContext implements Context, SnippetAcceptingContext {
$data['remoteServerUrl'] = $this->translateRemoteServer($invite['remoteServerUrl']);
}
if (isset($expectedInvite['state'])) {
- $data['state'] = (int) $invite['state'];
+ $data['state'] = $invite['state'];
}
return $data;
- }, $invites, $formData->getHash()));
+ }, $invites, $expectedInvites));
}
protected function translateRemoteServer(string $server): string {
diff --git a/tests/integration/features/federation/invite.feature b/tests/integration/features/federation/invite.feature
index dcb728d55..9c325228b 100644
--- a/tests/integration/features/federation/invite.feature
+++ b/tests/integration/features/federation/invite.feature
@@ -51,8 +51,8 @@ Feature: federation/invite
| 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)
- | remoteServerUrl | remoteToken | state |
- | LOCAL | room | 0 |
+ | remoteServerUrl | remoteToken | state | inviterCloudId | inviterDisplayName |
+ | LOCAL | room | 0 | participant1@http://localhost:8080 | participant1-displayname |
Then user "participant2" has the following notifications
| app | object_type | object_id | subject | message |
| spreed | remote_talk_share | INVITE_ID(LOCAL::room) | @participant1-displayname invited you to a federated conversation | @participant1-displayname invited you to join room on http://localhost:8080 |
@@ -62,8 +62,8 @@ Feature: federation/invite
And user "participant2" accepts invite to room "room" of server "LOCAL" with 400 (v1)
| error | state |
And user "participant2" has the following invitations (v1)
- | remoteServerUrl | remoteToken | state |
- | LOCAL | room | 1 |
+ | remoteServerUrl | remoteToken | state | inviterCloudId | inviterDisplayName |
+ | LOCAL | room | 1 | participant1@http://localhost:8080 | participant1-displayname |
When user "participant1" sees the following attendees in room "room" with 200 (v4)
| actorType | actorId | participantType |
| users | participant1 | 1 |
@@ -103,8 +103,8 @@ 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"}} |
And user "participant2" has the following invitations (v1)
- | remoteServerUrl | remoteToken | state |
- | LOCAL | room | 0 |
+ | remoteServerUrl | remoteToken | state | inviterCloudId | inviterDisplayName |
+ | LOCAL | room | 0 | participant1@http://localhost:8080 | participant1-displayname |
Then user "participant2" has the following notifications
| app | object_type | object_id | subject | message |
| spreed | remote_talk_share | INVITE_ID(LOCAL::room) | @participant1-displayname invited you to a federated conversation | @participant1-displayname invited you to join room on http://localhost:8080 |
@@ -138,8 +138,8 @@ Feature: federation/invite
| 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)
- | remoteServerUrl | remoteToken | state |
- | LOCAL | room | 0 |
+ | remoteServerUrl | remoteToken | state | inviterCloudId | inviterDisplayName |
+ | LOCAL | room | 0 | participant1@http://localhost:8080 | participant1-displayname |
Then user "participant2" has the following notifications
| app | object_type | object_id | subject | message |
| spreed | remote_talk_share | INVITE_ID(LOCAL::room) | @participant1-displayname invited you to a federated conversation | @participant1-displayname invited you to join room on http://localhost:8080 |
@@ -164,14 +164,14 @@ Feature: federation/invite
| roomName | room |
And user "participant1" adds remote "participant2" to room "room" with 200 (v4)
And user "participant2" has the following invitations (v1)
- | remoteServerUrl | remoteToken | state |
- | LOCAL | room | 0 |
+ | remoteServerUrl | remoteToken | state | inviterCloudId | inviterDisplayName |
+ | LOCAL | room | 0 | participant1@http://localhost:8080 | participant1-displayname |
And user "participant2" accepts invite to room "room" of server "LOCAL" with 200 (v1)
| id | name | type | remoteServer | remoteToken |
| room | room | 2 | LOCAL | room |
And user "participant2" has the following invitations (v1)
- | remoteServerUrl | remoteToken | state |
- | LOCAL | room | 1 |
+ | remoteServerUrl | remoteToken | state | inviterCloudId | inviterDisplayName |
+ | LOCAL | room | 1 | participant1@http://localhost:8080 | participant1-displayname |
Then user "participant2" is participant of the following rooms (v4)
| id | type |
| room | 2 |
@@ -190,8 +190,8 @@ Feature: federation/invite
| roomName | room |
And user "participant1" adds remote "participant2" to room "room" with 200 (v4)
And user "participant2" has the following invitations (v1)
- | remoteServerUrl | remoteToken | state |
- | LOCAL | room | 0 |
+ | remoteServerUrl | remoteToken | state | inviterCloudId | inviterDisplayName |
+ | LOCAL | room | 0 | participant1@http://localhost:8080 | participant1-displayname |
And user "participant2" accepts invite to room "room" of server "LOCAL" with 200 (v1)
| id | name | type | remoteServer | remoteToken |
| room | room | 2 | LOCAL | room |