Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2021-03-31 13:00:47 +0300
committerJoas Schilling <coding@schilljs.com>2021-03-31 14:19:05 +0300
commit44a7308254ab24de85aa4b9f63f496c53ece3a73 (patch)
tree3bda2c288abab6ae5c99fa657b57f0285709bbf2 /tests
parent5730ef0a7805e4bb08a76a03e76a574de666adb6 (diff)
Only remove users and not moderators when a group (membership) is removed
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/features/bootstrap/FeatureContext.php25
-rw-r--r--tests/integration/features/conversation/add-group.feature55
2 files changed, 80 insertions, 0 deletions
diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php
index 5c797ac24..698b4a98b 100644
--- a/tests/integration/features/bootstrap/FeatureContext.php
+++ b/tests/integration/features/bootstrap/FeatureContext.php
@@ -777,6 +777,31 @@ class FeatureContext implements Context, SnippetAcceptingContext {
}
/**
+ * @Then /^user "([^"]*)" removes (user|group|email) "([^"]*)" from room "([^"]*)" with (\d+) \((v4)\)$/
+ *
+ * @param string $user
+ * @param string $actorType
+ * @param string $actorId
+ * @param string $identifier
+ * @param int $statusCode
+ * @param string $apiVersion
+ */
+ public function userRemovesAttendeeFromRoom(string $user, string $actorType, string $actorId, string $identifier, int $statusCode, string$apiVersion): void {
+ if ($actorId === 'stranger') {
+ $attendeeId = 123456789;
+ } else {
+ $attendeeId = $this->getAttendeeId($actorType . 's', $actorId, $identifier, $statusCode === 200 ? $user : null);
+ }
+
+ $this->setCurrentUser($user);
+ $this->sendRequest(
+ 'DELETE', '/apps/spreed/api/' . $apiVersion . '/room/' . self::$identifierToToken[$identifier] . '/attendees',
+ new TableNode([['attendeeId', $attendeeId]])
+ );
+ $this->assertStatusCode($this->response, $statusCode);
+ }
+
+ /**
* @Then /^user "([^"]*)" deletes room "([^"]*)" with (\d+) \((v4)\)$/
*
* @param string $user
diff --git a/tests/integration/features/conversation/add-group.feature b/tests/integration/features/conversation/add-group.feature
index a232cef94..344ec873f 100644
--- a/tests/integration/features/conversation/add-group.feature
+++ b/tests/integration/features/conversation/add-group.feature
@@ -65,6 +65,61 @@ Feature: public
| users | participant1 | 1 |
| groups | group1 | 3 |
+ Scenario: User is removed from when their last group which is a member of a chat is removed
+ Given user "participant1" creates room "room" (v4)
+ | roomType | 2 |
+ | source | group |
+ | invite |group1 |
+ And user "participant1" sees the following attendees in room "room" with 200 (v4)
+ | actorType | actorId | participantType |
+ | users | participant1 | 1 |
+ | groups | group1 | 3 |
+ | users | participant2 | 3 |
+ And user "participant1" removes group "group1" from room "room" with 200 (v4)
+ And user "participant1" sees the following attendees in room "room" with 200 (v4)
+ | actorType | actorId | participantType |
+ | users | participant1 | 1 |
+
+ Scenario: Moderator is removed from a group which is a member of a chat but stays in the chat
+ Given user "participant1" creates room "room" (v4)
+ | roomType | 2 |
+ | source | group |
+ | invite |group1 |
+ And user "participant1" sees the following attendees in room "room" with 200 (v4)
+ | actorType | actorId | participantType |
+ | users | participant1 | 1 |
+ | groups | group1 | 3 |
+ | users | participant2 | 3 |
+ And user "participant1" promotes "participant2" in room "room" with 200 (v4)
+ And user "participant1" sees the following attendees in room "room" with 200 (v4)
+ | actorType | actorId | participantType |
+ | users | participant1 | 1 |
+ | groups | group1 | 3 |
+ | users | participant2 | 2 |
+ And user "participant2" is not member of group "group1"
+ And user "participant1" sees the following attendees in room "room" with 200 (v4)
+ | actorType | actorId | participantType |
+ | users | participant1 | 1 |
+ | groups | group1 | 3 |
+ | users | participant2 | 2 |
+
+ Scenario: Moderator is removed from a group which is a member of a chat but stays in the chat
+ Given user "participant1" creates room "room" (v4)
+ | roomType | 2 |
+ | source | group |
+ | invite |group1 |
+ And user "participant1" promotes "participant2" in room "room" with 200 (v4)
+ And user "participant1" sees the following attendees in room "room" with 200 (v4)
+ | actorType | actorId | participantType |
+ | users | participant1 | 1 |
+ | groups | group1 | 3 |
+ | users | participant2 | 2 |
+ And user "participant1" removes group "group1" from room "room" with 200 (v4)
+ And user "participant1" sees the following attendees in room "room" with 200 (v4)
+ | actorType | actorId | participantType |
+ | users | participant1 | 1 |
+ | users | participant2 | 2 |
+
Scenario: User that was already a member has their group added to a chat
Given user "participant1" creates room "room" (v4)
| roomType | 3 |