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:
authorVincent Petry <vincent@nextcloud.com>2020-12-01 13:56:54 +0300
committerVincent Petry <vincent@nextcloud.com>2020-12-11 20:15:47 +0300
commit17971cd34a6ecb0cdf4e926e41414f13a2bd4c41 (patch)
treeabb522f422fd26ff1654eabdaacfe54ed5d09a94 /tests
parentbe0ed4a7f5f3b7eaa8acef96258862929dfd729f (diff)
Add listable flags attribute for conversations
Added ability to set a conversation as listable for regular users and/or guest users from the guest app. This only implements the flag, endpoint and UI to manage it but not yet making it appear in search results. Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/features/bootstrap/FeatureContext.php30
-rw-r--r--tests/integration/features/command/create.feature4
-rw-r--r--tests/php/CapabilitiesTest.php2
-rw-r--r--tests/php/RoomTest.php1
-rw-r--r--tests/php/Signaling/BackendNotifierTest.php31
5 files changed, 66 insertions, 2 deletions
diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php
index 5403bc839..6ad43e23c 100644
--- a/tests/integration/features/bootstrap/FeatureContext.php
+++ b/tests/integration/features/bootstrap/FeatureContext.php
@@ -30,6 +30,7 @@ use GuzzleHttp\Cookie\CookieJar;
use GuzzleHttp\Exception\ClientException;
use PHPUnit\Framework\Assert;
use Psr\Http\Message\ResponseInterface;
+use OCA\Talk\Room;
/**
* Defines application features from the specific context.
@@ -174,6 +175,9 @@ class FeatureContext implements Context, SnippetAcceptingContext {
if (isset($expectedRoom['readOnly'])) {
$data['readOnly'] = (string) $room['readOnly'];
}
+ if (isset($expectedRoom['listable'])) {
+ $data['listable'] = (string) $room['listable'];
+ }
if (isset($expectedRoom['participantType'])) {
$data['participantType'] = (string) $room['participantType'];
}
@@ -794,6 +798,32 @@ class FeatureContext implements Context, SnippetAcceptingContext {
}
/**
+ * @Then /^user "([^"]*)" allows listing room "([^"]*)" for "(joined|users|all)" with (\d+)(?: \((v(1|2|3))\))?$/
+ *
+ * @param string $user
+ * @param string $newState
+ * @param string $identifier
+ * @param string $statusCode
+ * @param string $apiVersion
+ */
+ public function userChangesListableScopeOfTheRoom($user, $identifier, $newState, $statusCode, $apiVersion = 'v3') {
+ $this->setCurrentUser($user);
+ if ($newState === 'joined') {
+ $newStateValue = Room::LISTABLE_PARTICIPANTS;
+ } elseif ($newState === 'users') {
+ $newStateValue = Room::LISTABLE_USERS;
+ } else {
+ $newStateValue = Room::LISTABLE_ALL;
+ }
+
+ $this->sendRequest(
+ 'PUT', '/apps/spreed/api/' . $apiVersion . '/room/' . self::$identifierToToken[$identifier] . '/listable',
+ new TableNode([['state', $newStateValue]])
+ );
+ $this->assertStatusCode($this->response, $statusCode);
+ }
+
+ /**
* @Then /^user "([^"]*)" adds "([^"]*)" to room "([^"]*)" with (\d+)(?: \((v(1|2|3))\))?$/
*
* @param string $user
diff --git a/tests/integration/features/command/create.feature b/tests/integration/features/command/create.feature
index 5463769aa..07d5cb4d3 100644
--- a/tests/integration/features/command/create.feature
+++ b/tests/integration/features/command/create.feature
@@ -41,8 +41,8 @@ Feature: create
| name | type | participantType | participants |
| room1 | 3 | 3 | participant1-displayname, participant2-displayname |
- Scenario: Create a public room for participant1 as owner group1 as users with password and readonly
- Given invoking occ with "talk:room:create room1 --user participant1 --owner participant1 --public --group group1 --readonly --password test"
+ Scenario: Create a public room for participant1 as owner group1 as users with password and readonly and listable
+ Given invoking occ with "talk:room:create room1 --user participant1 --owner participant1 --public --group group1 --readonly --listable 2 --password test"
And the command output contains the text "Room successfully created"
Then the command was successful
And user "participant1" is participant of the following rooms
diff --git a/tests/php/CapabilitiesTest.php b/tests/php/CapabilitiesTest.php
index 0299868b7..f97fcb57f 100644
--- a/tests/php/CapabilitiesTest.php
+++ b/tests/php/CapabilitiesTest.php
@@ -94,6 +94,7 @@ class CapabilitiesTest extends TestCase {
'invite-groups-and-mails',
'locked-one-to-one-rooms',
'read-only-rooms',
+ 'listable-rooms',
'chat-read-marker',
'webinary-lobby',
'start-call-flag',
@@ -199,6 +200,7 @@ class CapabilitiesTest extends TestCase {
'invite-groups-and-mails',
'locked-one-to-one-rooms',
'read-only-rooms',
+ 'listable-rooms',
'chat-read-marker',
'webinary-lobby',
'start-call-flag',
diff --git a/tests/php/RoomTest.php b/tests/php/RoomTest.php
index db5bebd8d..1b26775c2 100644
--- a/tests/php/RoomTest.php
+++ b/tests/php/RoomTest.php
@@ -63,6 +63,7 @@ class RoomTest extends TestCase {
1,
Room::PUBLIC_CALL,
Room::READ_WRITE,
+ Room::LISTABLE_PARTICIPANTS,
Webinary::LOBBY_NONE,
0,
null,
diff --git a/tests/php/Signaling/BackendNotifierTest.php b/tests/php/Signaling/BackendNotifierTest.php
index 2af62fb72..d6d347665 100644
--- a/tests/php/Signaling/BackendNotifierTest.php
+++ b/tests/php/Signaling/BackendNotifierTest.php
@@ -252,6 +252,7 @@ class BackendNotifierTest extends \Test\TestCase {
'lobby-state' => Webinary::LOBBY_NONE,
'lobby-timer' => null,
'read-only' => Room::READ_WRITE,
+ 'listable' => Room::LISTABLE_PARTICIPANTS,
'active-since' => null,
'sip-enabled' => 0,
],
@@ -287,6 +288,7 @@ class BackendNotifierTest extends \Test\TestCase {
'lobby-state' => Webinary::LOBBY_NONE,
'lobby-timer' => null,
'read-only' => Room::READ_WRITE,
+ 'listable' => Room::LISTABLE_PARTICIPANTS,
'active-since' => null,
'sip-enabled' => 0,
],
@@ -333,6 +335,7 @@ class BackendNotifierTest extends \Test\TestCase {
'lobby-state' => Webinary::LOBBY_NONE,
'lobby-timer' => null,
'read-only' => Room::READ_WRITE,
+ 'listable' => Room::LISTABLE_PARTICIPANTS,
'active-since' => null,
'sip-enabled' => 0,
],
@@ -356,6 +359,7 @@ class BackendNotifierTest extends \Test\TestCase {
'lobby-state' => Webinary::LOBBY_NONE,
'lobby-timer' => null,
'read-only' => Room::READ_WRITE,
+ 'listable' => Room::LISTABLE_PARTICIPANTS,
'active-since' => null,
'sip-enabled' => 0,
],
@@ -379,6 +383,7 @@ class BackendNotifierTest extends \Test\TestCase {
'lobby-state' => Webinary::LOBBY_NONE,
'lobby-timer' => null,
'read-only' => Room::READ_WRITE,
+ 'listable' => Room::LISTABLE_PARTICIPANTS,
'active-since' => null,
'sip-enabled' => 0,
],
@@ -402,6 +407,30 @@ class BackendNotifierTest extends \Test\TestCase {
'lobby-state' => Webinary::LOBBY_NONE,
'lobby-timer' => null,
'read-only' => Room::READ_ONLY,
+ 'listable' => Room::LISTABLE_PARTICIPANTS,
+ 'active-since' => null,
+ 'sip-enabled' => 0,
+ ],
+ ],
+ ]);
+ }
+
+ public function testRoomListableChanged() {
+ $room = $this->manager->createRoom(Room::PUBLIC_CALL);
+ $room->setListable(Room::LISTABLE_ALL);
+
+ $this->assertMessageWasSent($room, [
+ 'type' => 'update',
+ 'update' => [
+ 'userids' => [
+ ],
+ 'properties' => [
+ 'name' => $room->getDisplayName(''),
+ 'type' => $room->getType(),
+ 'lobby-state' => Webinary::LOBBY_NONE,
+ 'lobby-timer' => null,
+ 'read-only' => Room::READ_WRITE,
+ 'listable' => Room::LISTABLE_ALL,
'active-since' => null,
'sip-enabled' => 0,
],
@@ -425,6 +454,7 @@ class BackendNotifierTest extends \Test\TestCase {
'lobby-state' => Webinary::LOBBY_NON_MODERATORS,
'lobby-timer' => null,
'read-only' => Room::READ_WRITE,
+ 'listable' => Room::LISTABLE_PARTICIPANTS,
'active-since' => null,
'sip-enabled' => 0,
],
@@ -584,6 +614,7 @@ class BackendNotifierTest extends \Test\TestCase {
'lobby-state' => Webinary::LOBBY_NONE,
'lobby-timer' => null,
'read-only' => Room::READ_WRITE,
+ 'listable' => Room::LISTABLE_PARTICIPANTS,
'active-since' => null,
'sip-enabled' => 0,
'foo' => 'bar',