diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2023-02-02 07:00:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-02 07:00:50 +0100 |
commit | 820839c5f0fb28613c4b9fb5c08e41a842f703ac (patch) | |
tree | 1984d7e4a0ee2dd533f3f39e2adcbd4b882d97a1 /tests | |
parent | a37667a99ea2c9c69b630f3ca76fac84278d79e7 (diff) | |
parent | 54bc20ce6b0e36f328c5e11c6e58581acdd0b783 (diff) |
Merge pull request #8660 from nextcloud/feature/8610/add-endpoint-to-return-all-participants
Add an endpoint to return all participants
Diffstat (limited to 'tests')
-rw-r--r-- | tests/integration/features/bootstrap/FeatureContext.php | 36 | ||||
-rw-r--r-- | tests/integration/features/conversation/breakout-rooms.feature | 12 |
2 files changed, 48 insertions, 0 deletions
diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php index aa5729251..f763bdfda 100644 --- a/tests/integration/features/bootstrap/FeatureContext.php +++ b/tests/integration/features/bootstrap/FeatureContext.php @@ -580,11 +580,44 @@ class FeatureContext implements Context, SnippetAcceptingContext { if ($formData instanceof TableNode) { $attendees = $this->getDataFromResponse($this->response); + } else { + $attendees = []; + } + $this->assertAttendeeList($identifier, $formData, $attendees); + } + + /** + * @Then /^user "([^"]*)" sees the following attendees in breakout rooms for room "([^"]*)" with (\d+) \((v4)\)$/ + * + * @param string $user + * @param string $identifier + * @param int $statusCode + * @param string $apiVersion + * @param TableNode $formData + */ + public function userSeesAttendeesInBreakoutRoomsForRoom(string $user, string $identifier, int $statusCode, string $apiVersion, TableNode $formData = null): void { + $this->setCurrentUser($user); + $this->sendRequest('GET', '/apps/spreed/api/' . $apiVersion . '/room/' . self::$identifierToToken[$identifier] . '/breakout-rooms/participants'); + $this->assertStatusCode($this->response, $statusCode); + + if ($formData instanceof TableNode) { + $attendees = $this->getDataFromResponse($this->response); + } else { + $attendees = []; + } + $this->assertAttendeeList($identifier, $formData, $attendees); + } + + protected function assertAttendeeList(string $identifier, ?TableNode $formData, array $attendees): void { + if ($formData instanceof TableNode) { $expectedKeys = array_flip($formData->getRows()[0]); $result = []; foreach ($attendees as $attendee) { $data = []; + if (isset($expectedKeys['roomToken'])) { + $data['roomToken'] = self::$tokenToIdentifier[$attendee['roomToken']]; + } if (isset($expectedKeys['actorType'])) { $data['actorType'] = $attendee['actorType']; } @@ -676,6 +709,9 @@ class FeatureContext implements Context, SnippetAcceptingContext { } protected static function sortAttendees(array $a1, array $a2): int { + if (array_key_exists('roomToken', $a1) && array_key_exists('roomToken', $a2) && $a1['roomToken'] !== $a2['roomToken']) { + return $a1['roomToken'] <=> $a2['roomToken']; + } if (array_key_exists('participantType', $a1) && array_key_exists('participantType', $a2) && $a1['participantType'] !== $a2['participantType']) { return $a1['participantType'] <=> $a2['participantType']; } diff --git a/tests/integration/features/conversation/breakout-rooms.feature b/tests/integration/features/conversation/breakout-rooms.feature index 279fe5e09..aedc91e6f 100644 --- a/tests/integration/features/conversation/breakout-rooms.feature +++ b/tests/integration/features/conversation/breakout-rooms.feature @@ -41,6 +41,18 @@ Feature: conversation/breakout-rooms | type | name | | 2 | class room | | 2 | Room 3 | + And user "participant1" sees the following attendees in breakout rooms for room "class room" with 200 (v4) + | roomToken | actorType | actorId | participantType | + | class room | users | participant1 | 1 | + | class room | users | participant2 | 3 | + | class room | users | participant3 | 3 | + | class room | users | participant4 | 3 | + | Room 1 | users | participant1 | 1 | + | Room 1 | users | participant2 | 3 | + | Room 2 | users | participant1 | 1 | + | Room 2 | users | participant3 | 3 | + | Room 3 | users | participant1 | 1 | + | Room 3 | users | participant4 | 3 | Scenario: Teacher creates automatic breakout rooms Given user "participant1" creates room "class room" (v4) |