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:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2020-11-13 05:17:26 +0300
committerJoas Schilling <coding@schilljs.com>2020-12-08 15:00:10 +0300
commitd259efdae4aea4a442b95a4d2e21d180f76b0c6b (patch)
tree0b35a7cc9ea1c59b2201115c7bde96371f2e8037 /tests
parent38bc918874994859c12aa258d536719dfdaa26d9 (diff)
Add integration tests for getting and setting the room description
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/features/bootstrap/FeatureContext.php40
-rw-r--r--tests/integration/features/conversation/lobby.feature37
-rw-r--r--tests/integration/features/conversation/set-description.feature345
3 files changed, 395 insertions, 27 deletions
diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php
index 9bde7852f..7bdd49fb1 100644
--- a/tests/integration/features/bootstrap/FeatureContext.php
+++ b/tests/integration/features/bootstrap/FeatureContext.php
@@ -162,6 +162,9 @@ class FeatureContext implements Context, SnippetAcceptingContext {
if (isset($expectedRoom['name'])) {
$data['name'] = $room['name'];
}
+ if (isset($expectedRoom['description'])) {
+ $data['description'] = $room['description'];
+ }
if (isset($expectedRoom['type'])) {
$data['type'] = (string) $room['type'];
}
@@ -174,6 +177,15 @@ class FeatureContext implements Context, SnippetAcceptingContext {
if (isset($expectedRoom['participantType'])) {
$data['participantType'] = (string) $room['participantType'];
}
+ if (isset($expectedRoom['sipEnabled'])) {
+ $data['sipEnabled'] = (string) $room['sipEnabled'];
+ }
+ if (isset($expectedRoom['attendeePin'])) {
+ $data['attendeePin'] = $room['attendeePin'] ? '**PIN**' : '';
+ }
+ if (isset($expectedRoom['lastMessage'])) {
+ $data['lastMessage'] = $room['lastMessage'] ? $room['lastMessage']['message'] : '';
+ }
if (isset($expectedRoom['participants'])) {
$participantNames = array_map(function ($participant) {
return $participant['name'];
@@ -200,15 +212,6 @@ class FeatureContext implements Context, SnippetAcceptingContext {
}
$data['participants'] = implode(', ', $participantNames);
}
- if (isset($expectedRoom['sipEnabled'])) {
- $data['sipEnabled'] = (string) $room['sipEnabled'];
- }
- if (isset($expectedRoom['attendeePin'])) {
- $data['attendeePin'] = $room['attendeePin'] ? '**PIN**' : '';
- }
- if (isset($expectedRoom['lastMessage'])) {
- $data['lastMessage'] = $room['lastMessage'] ? $room['lastMessage']['message'] : '';
- }
return $data;
}, $rooms, $formData->getHash()));
@@ -666,6 +669,25 @@ class FeatureContext implements Context, SnippetAcceptingContext {
}
/**
+ * @When /^user "([^"]*)" sets description for room "([^"]*)" to "([^"]*)" with (\d+)(?: \((v(1|2|3))\))?$/
+ *
+ * @param string $user
+ * @param string $identifier
+ * @param string $description
+ * @param string $statusCode
+ * @param string $apiVersion
+ * @param TableNode
+ */
+ public function userSetsDescriptionForRoomTo($user, $identifier, $description, $statusCode, $apiVersion = 'v3') {
+ $this->setCurrentUser($user);
+ $this->sendRequest(
+ 'PUT', '/apps/spreed/api/' .$apiVersion . '/room/' . self::$identifierToToken[$identifier] . '/description',
+ new TableNode([['description', $description]])
+ );
+ $this->assertStatusCode($this->response, $statusCode);
+ }
+
+ /**
* @When /^user "([^"]*)" sets password "([^"]*)" for room "([^"]*)" with (\d+)(?: \((v(1|2|3))\))?$/
*
* @param string $user
diff --git a/tests/integration/features/conversation/lobby.feature b/tests/integration/features/conversation/lobby.feature
index 1e7ea7820..5434ad0c9 100644
--- a/tests/integration/features/conversation/lobby.feature
+++ b/tests/integration/features/conversation/lobby.feature
@@ -230,21 +230,22 @@ Feature: conversation/lobby
And user "guest2" joins room "room" with 200
When user "participant1" sets lobby state for room "room" to "non moderators" with 200
And user "participant1" sends message "Message 1" to room "room" with 201
- Then user "participant1" is participant of room "room"
- | name | type | participantType | lastMessage |
- | room | 3 | 1 | Message 1 |
- And user "participant2" is participant of room "room"
- | name | type | participantType | lastMessage |
- | room | 3 | 2 | Message 1 |
- And user "participant3" is participant of room "room"
- | name | type | participantType | lastMessage |
- | room | 3 | 3 | |
- And user "participant4" is participant of room "room"
- | name | type | participantType | lastMessage |
- | room | 3 | 5 | |
- And user "guest" is participant of room "room"
- | name | type | participantType | lastMessage |
- | room | 3 | 6 | Message 1 |
- And user "guest2" is participant of room "room"
- | name | type | participantType | lastMessage |
- | room | 3 | 4 | |
+ And user "participant1" sets description for room "room" to "the description" with 200
+ Then user "participant1" is participant of room "room" (v3)
+ | name | description | type | participantType | lastMessage |
+ | room | the description | 3 | 1 | Message 1 |
+ And user "participant2" is participant of room "room" (v3)
+ | name | description | type | participantType | lastMessage |
+ | room | the description | 3 | 2 | Message 1 |
+ And user "participant3" is participant of room "room" (v3)
+ | name | description | type | participantType | lastMessage |
+ | room | the description | 3 | 3 | |
+ And user "participant4" is participant of room "room" (v3)
+ | name | description | type | participantType | lastMessage |
+ | room | the description | 3 | 5 | |
+ And user "guest" is participant of room "room" (v3)
+ | name | description | type | participantType | lastMessage |
+ | room | the description | 3 | 6 | Message 1 |
+ And user "guest2" is participant of room "room" (v3)
+ | name | description | type | participantType | lastMessage |
+ | room | the description | 3 | 4 | |
diff --git a/tests/integration/features/conversation/set-description.feature b/tests/integration/features/conversation/set-description.feature
new file mode 100644
index 000000000..73212a779
--- /dev/null
+++ b/tests/integration/features/conversation/set-description.feature
@@ -0,0 +1,345 @@
+Feature: set-description
+ Background:
+ Given user "owner" exists
+ Given user "moderator" exists
+ Given user "invited user" exists
+ Given user "not invited but joined user" exists
+ Given user "not joined user" exists
+
+ Scenario: a description of 250 characters can be set
+ Given user "owner" creates room "group room"
+ | roomType | 2 |
+ | roomName | room |
+ When user "owner" sets description for room "group room" to "012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678C012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678C0123456789012345678901234567890123456789012345678L" with 200
+ Then user "owner" is participant of room "group room" (v3)
+ | description |
+ | 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678C012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678C0123456789012345678901234567890123456789012345678L |
+
+ Scenario: a description longer than 250 characters can not be set
+ Given user "owner" creates room "group room"
+ | roomType | 2 |
+ | roomName | room |
+ And user "owner" sets description for room "group room" to "the description" with 200
+ When user "owner" sets description for room "group room" to "012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678C012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678C0123456789012345678901234567890123456789012345678L0" with 400
+ Then user "owner" is participant of room "group room" (v3)
+ | description |
+ | the description |
+
+ Scenario: a description of 250 multibyte characters can be set
+ Given user "owner" creates room "group room"
+ | roomType | 2 |
+ | roomName | room |
+ When user "owner" sets description for room "group room" to "०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८च०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८च०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८ल" with 200
+ Then user "owner" is participant of room "group room" (v3)
+ | description |
+ | ०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८च०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८च०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८ल |
+
+ Scenario: a description longer than 250 multibyte characters can not be set
+ Given user "owner" creates room "group room"
+ | roomType | 2 |
+ | roomName | room |
+ And user "owner" sets description for room "group room" to "the description" with 200
+ When user "owner" sets description for room "group room" to "०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८च०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८च०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८९०१२३४५६७८ल०" with 400
+ Then user "owner" is participant of room "group room" (v3)
+ | description |
+ | the description |
+
+
+
+ Scenario: owner can not set description in one-to-one room
+ Given user "owner" creates room "one-to-one room"
+ | roomType | 1 |
+ | invite | moderator |
+ When user "owner" sets description for room "one-to-one room" to "the description" with 400
+ And user "moderator" sets description for room "one-to-one room" to "the description" with 400
+ Then user "owner" is participant of room "one-to-one room" (v3)
+ | description |
+ | |
+ And user "moderator" is participant of room "one-to-one room" (v3)
+ | description |
+ | |
+
+
+
+ Scenario: owner can set description in group room
+ Given user "owner" creates room "group room"
+ | roomType | 2 |
+ | roomName | room |
+ And user "owner" adds "moderator" to room "group room" with 200
+ And user "owner" promotes "moderator" in room "group room" with 200
+ And user "owner" adds "invited user" to room "group room" with 200
+ When user "owner" sets description for room "group room" to "the description" with 200
+ Then user "owner" is participant of room "group room" (v3)
+ | description |
+ | the description |
+ And user "moderator" is participant of room "group room" (v3)
+ | description |
+ | the description |
+ And user "invited user" is participant of room "group room" (v3)
+ | description |
+ | the description |
+
+ Scenario: moderator can set description in group room
+ Given user "owner" creates room "group room"
+ | roomType | 2 |
+ | roomName | room |
+ And user "owner" adds "moderator" to room "group room" with 200
+ And user "owner" promotes "moderator" in room "group room" with 200
+ And user "owner" adds "invited user" to room "group room" with 200
+ When user "moderator" sets description for room "group room" to "the description" with 200
+ Then user "owner" is participant of room "group room" (v3)
+ | description |
+ | the description |
+ And user "moderator" is participant of room "group room" (v3)
+ | description |
+ | the description |
+ And user "invited user" is participant of room "group room" (v3)
+ | description |
+ | the description |
+
+ Scenario: others can not set description in group room
+ Given user "owner" creates room "group room"
+ | roomType | 2 |
+ | roomName | room |
+ And user "owner" adds "moderator" to room "group room" with 200
+ And user "owner" promotes "moderator" in room "group room" with 200
+ And user "owner" adds "invited user" to room "group room" with 200
+ And user "owner" sets description for room "group room" to "the description" with 200
+ When user "invited user" sets description for room "group room" to "invited user description" with 403
+ And user "not invited user" sets description for room "group room" to "not invited user description" with 404
+ # Guest user names in tests must being with "guest"
+ And user "guest not joined" sets description for room "group room" to "guest not joined description" with 404
+ Then user "owner" is participant of room "group room" (v3)
+ | description |
+ | the description |
+ And user "moderator" is participant of room "group room" (v3)
+ | description |
+ | the description |
+ And user "invited user" is participant of room "group room" (v3)
+ | description |
+ | the description |
+
+
+
+ Scenario: owner can set description in public room
+ Given user "owner" creates room "public room"
+ | roomType | 3 |
+ | roomName | room |
+ And user "owner" adds "moderator" to room "public room" with 200
+ And user "owner" promotes "moderator" in room "public room" with 200
+ And user "owner" adds "invited user" to room "public room" with 200
+ And user "not invited but joined user" joins room "public room" with 200
+ And user "guest moderator" joins room "public room" with 200
+ And user "owner" promotes "guest moderator" in room "public room" with 200
+ And user "guest" joins room "public room" with 200
+ When user "owner" sets description for room "public room" to "the description" with 200
+ Then user "owner" is participant of room "public room" (v3)
+ | description |
+ | the description |
+ And user "moderator" is participant of room "public room" (v3)
+ | description |
+ | the description |
+ And user "invited user" is participant of room "public room" (v3)
+ | description |
+ | the description |
+ And user "not invited but joined user" is participant of room "public room" (v3)
+ | description |
+ | the description |
+ And user "guest moderator" is participant of room "public room" (v3)
+ | description |
+ | the description |
+ And user "guest" is participant of room "public room" (v3)
+ | description |
+ | the description |
+
+ Scenario: moderator can set description in public room
+ Given user "owner" creates room "public room"
+ | roomType | 3 |
+ | roomName | room |
+ And user "owner" adds "moderator" to room "public room" with 200
+ And user "owner" promotes "moderator" in room "public room" with 200
+ And user "owner" adds "invited user" to room "public room" with 200
+ And user "not invited but joined user" joins room "public room" with 200
+ And user "guest moderator" joins room "public room" with 200
+ And user "owner" promotes "guest moderator" in room "public room" with 200
+ And user "guest" joins room "public room" with 200
+ When user "moderator" sets description for room "public room" to "the description" with 200
+ Then user "owner" is participant of room "public room" (v3)
+ | description |
+ | the description |
+ And user "moderator" is participant of room "public room" (v3)
+ | description |
+ | the description |
+ And user "invited user" is participant of room "public room" (v3)
+ | description |
+ | the description |
+ And user "not invited but joined user" is participant of room "public room" (v3)
+ | description |
+ | the description |
+ And user "guest moderator" is participant of room "public room" (v3)
+ | description |
+ | the description |
+ And user "guest" is participant of room "public room" (v3)
+ | description |
+ | the description |
+
+ Scenario: guest moderator can set description in public room
+ Given user "owner" creates room "public room"
+ | roomType | 3 |
+ | roomName | room |
+ And user "owner" adds "moderator" to room "public room" with 200
+ And user "owner" promotes "moderator" in room "public room" with 200
+ And user "owner" adds "invited user" to room "public room" with 200
+ And user "not invited but joined user" joins room "public room" with 200
+ And user "guest moderator" joins room "public room" with 200
+ And user "owner" promotes "guest moderator" in room "public room" with 200
+ And user "guest" joins room "public room" with 200
+ When user "guest moderator" sets description for room "public room" to "the description" with 200
+ Then user "owner" is participant of room "public room" (v3)
+ | description |
+ | the description |
+ And user "moderator" is participant of room "public room" (v3)
+ | description |
+ | the description |
+ And user "invited user" is participant of room "public room" (v3)
+ | description |
+ | the description |
+ And user "not invited but joined user" is participant of room "public room" (v3)
+ | description |
+ | the description |
+ And user "guest moderator" is participant of room "public room" (v3)
+ | description |
+ | the description |
+ And user "guest" is participant of room "public room" (v3)
+ | description |
+ | the description |
+
+ Scenario: others can not set description in public room
+ Given user "owner" creates room "public room"
+ | roomType | 3 |
+ | roomName | room |
+ And user "owner" adds "moderator" to room "public room" with 200
+ And user "owner" promotes "moderator" in room "public room" with 200
+ And user "owner" adds "invited user" to room "public room" with 200
+ And user "not invited but joined user" joins room "public room" with 200
+ And user "guest moderator" joins room "public room" with 200
+ And user "owner" promotes "guest moderator" in room "public room" with 200
+ And user "guest" joins room "public room" with 200
+ And user "owner" sets description for room "public room" to "the description" with 200
+ When user "invited user" sets description for room "public room" to "invited user description" with 403
+ And user "not invited but joined user" sets description for room "public room" to "not invited but joined description" with 403
+ And user "not joined user" sets description for room "public room" to "not joined user description" with 404
+ And user "guest" sets description for room "public room" to "guest description" with 403
+ # Guest user names in tests must being with "guest"
+ And user "guest not joined" sets description for room "public room" to "guest not joined description" with 404
+ Then user "owner" is participant of room "public room" (v3)
+ | description |
+ | the description |
+ And user "moderator" is participant of room "public room" (v3)
+ | description |
+ | the description |
+ And user "invited user" is participant of room "public room" (v3)
+ | description |
+ | the description |
+ And user "not invited but joined user" is participant of room "public room" (v3)
+ | description |
+ | the description |
+ And user "guest moderator" is participant of room "public room" (v3)
+ | description |
+ | the description |
+ And user "guest" is participant of room "public room" (v3)
+ | description |
+ | the description |
+
+
+
+ Scenario: participants can not set description in room for a share
+ # These users are only needed in very specific tests, so they are not
+ # created in the background step.
+ Given user "owner of file" exists
+ And user "user with access to file" exists
+ And user "owner of file" shares "welcome.txt" with user "user with access to file" with OCS 100
+ And user "user with access to file" accepts last share
+ And user "owner of file" shares "welcome.txt" by link with OCS 100
+ And user "guest" gets the room for last share with 200
+ And user "owner of file" joins room "file last share room" with 200
+ And user "user with access to file" joins room "file last share room" with 200
+ And user "guest" joins room "file last share room" with 200
+ When user "owner of file" sets description for room "file last share room" to "owner of file description" with 403
+ And user "user with access to file" sets description for room "file last share room" to "user with access to file description" with 403
+ And user "guest" sets description for room "file last share room" to "guest description" with 403
+ Then user "owner of file" is participant of room "file last share room" (v3)
+ | description |
+ | |
+ And user "user with access to file" is participant of room "file last share room" (v3)
+ | description |
+ | |
+ And user "guest" is participant of room "file last share room" (v3)
+ | description |
+ | |
+
+
+
+ Scenario: owner can set description in a password request room
+ # The user is only needed in very specific tests, so it is not created in
+ # the background step.
+ Given user "owner of file" exists
+ And user "owner of file" shares "welcome.txt" by link with OCS 100
+ | password | 123456 |
+ | sendPasswordByTalk | true |
+ And user "guest" creates the password request room for last share with 201
+ And user "guest" joins room "password request for last share room" with 200
+ And user "owner of file" joins room "password request for last share room" with 200
+ When user "owner of file" sets description for room "password request for last share room" to "the description" with 200
+ Then user "owner of file" is participant of room "password request for last share room" (v3)
+ | description |
+ | the description |
+ And user "guest" is participant of room "password request for last share room" (v3)
+ | description |
+ | the description |
+
+
+
+ Scenario: room list returns the hashed description if the description is set
+ Given user "owner" creates room "public room"
+ | roomType | 3 |
+ | roomName | room |
+ And user "owner" adds "moderator" to room "public room" with 200
+ And user "owner" promotes "moderator" in room "public room" with 200
+ And user "owner" adds "invited user" to room "public room" with 200
+ And user "not invited but joined user" joins room "public room" with 200
+ When user "owner" sets description for room "public room" to "the description" with 200
+ Then user "owner" is participant of the following rooms (v3)
+ | name | description |
+ | room | dc90bdf167b8d5598ac2ac3812aa71e34de10ce2 |
+ And user "moderator" is participant of the following rooms (v3)
+ | name | description |
+ | room | dc90bdf167b8d5598ac2ac3812aa71e34de10ce2 |
+ And user "invited user" is participant of the following rooms (v3)
+ | name | description |
+ | room | dc90bdf167b8d5598ac2ac3812aa71e34de10ce2 |
+ And user "not invited but joined user" is participant of the following rooms (v3)
+ | name | description |
+ | room | dc90bdf167b8d5598ac2ac3812aa71e34de10ce2 |
+
+ Scenario: room list returns an empty value if the description is not set
+ Given user "owner" creates room "public room"
+ | roomType | 3 |
+ | roomName | room |
+ And user "owner" adds "moderator" to room "public room" with 200
+ And user "owner" promotes "moderator" in room "public room" with 200
+ And user "owner" adds "invited user" to room "public room" with 200
+ And user "not invited but joined user" joins room "public room" with 200
+ When user "owner" sets description for room "public room" to "" with 200
+ Then user "owner" is participant of the following rooms (v3)
+ | name | description |
+ | room | |
+ And user "moderator" is participant of the following rooms (v3)
+ | name | description |
+ | room | |
+ And user "invited user" is participant of the following rooms (v3)
+ | name | description |
+ | room | |
+ And user "not invited but joined user" is participant of the following rooms (v3)
+ | name | description |
+ | room | |